I have an ASCX control that has to render Silverlight dynamically. The dynamic code works in a non-MVC environment, however when I try to load the silverlight into an MVC ASCX, I get a ScriptManager error. However, my main aspx page does reference the masterpage, which has a script manager. I just need the control to realize that there will be a scriptmanager once it is plugged into the main page. I am trying to use a ScriptManagerProxy, but it is still looking for the ScriptManager. So, I think my biggest problem is getting the control to recognize the masterpage from the main page. Hopefully this explains my problem properly. If you need any code snippets, I can provide them
I don't think you should be using ScriptManager with MVC. ScriptManager is for Web Forms. There is a 3rd party one for MVC http://mvcscriptmanager.codeplex.com/.
I don't know that I quite understand what you are trying to accomplish. But you can use an IFrame (yuck) in your MVC page to display an aspx page.
Related
I want to add IFrame to my Silverlight web site. and into that iframe i want to add aspx page. is that possible? (aspx page in silverlight.)
It's posible in your HTML where you call the Silverlight xap file, but not inside Silverlight itself
Yes you can add what ever asp / html elements to the web page where your silverlight application is running.
For example modify the ProjectNameTestPage.aspx in your web project.
Actually it is possible to have HTML content nested within the Silverlight, Telerik for example has a control called "HtmlWindow" or "RadWindow" which does just this. Either you could subscribe to their control set or try and find out how they did it.
I have used Telerik's control multiple times in an MEF Silverlight application where different web applications (SSRS for example) are contained with the MEF plugins.
I am totally to Silverlight and am Getting started. I finished the first of the Getting started series here and now seeing into HTML Bridge now over here. Visual Studio created a website for me when it created the new silverlight application. For the HTML bridge tutorial I created another silverlight page(Is this what i should create) and put some code into it.
Question
How do I embed this into a html page? ( I know how to do it using markup as well as javascript, I am confused as to how to get the application out of single xap file inside ClientBin directory)
With Silverlight you are dealing with a single plugin within a HTML page. That plugin is the single XAP file that the HTML page downloads.
Your Silverlight app may also have many pages, but its navigation is not the same as HTML navigation (it uses bookmark URLs to fool the browser into staying on the same page while it changes content). There is only the one HTML page involved.
Initially, just to test your new page, you can change the app.xaml.cs file to create your new Silverlight Page instead of RootVisual = new Main() etc. Long term you need one Silverlight application per separate plugin your require.
Update (from comments):
Pages in Silverlight are changed by substituting a visual element of the single main page with the contents of another Silverlight page.
You cannot simply replace the RootVisual (as that can only be set at startup).
Start with a new Navigation or Business application project to see the basics (navigation adds a lot of complexity, but once you see how it works it is pretty cool).
I want to make a silverlight web part hosted in SharePoint 2010 that will take up the entire screen. I know how to get rid of all the SharePoint navigation through CSS or a custom master page, but I'm struggling with how to get a web part zone to grow to the full height available. I've messed around with using CSS or jquery to set the heights of the various tables and divs that wrap a web part and haven't found a good solution. Has anyone done this?
How about not using a webpart, and just embedding the Silverlight application into an empty page with an empty masterpage?
You can grab the html or aspx page that Visual Studio generates when you create an new Silverlight project.
I would suggest you to get a new master page for this purpose. You can get the minimal master page here:
http://blog.drisgill.com/2009/11/starter-master-pages-for-sharepoint.html
I am writing Silverlight 4 application with Navigation framework and MEF.
In my application each menu for navigation must load on MEF project and show it.
But there are some problems. First of all I can't navigate to page of other XAP(see David Polls post). To do that I need DynamicNavigation.dll and must create extra pages, which is not acceptable in my case. Other soluction can be found on davidezordan.net. This version is looks much better.
Second problem for me is that example works great if there is on additional XAP, but if I load 2 or more XAPs(by clicking on menus for navigation), I can't decide which page to show.
If 2 XAPs are loaded MEFModuleList contains 2 pages and I can't get any information about them to decide which page to show.
One solution is to hard code XAP name of each project in pages, which will be loaded to MEFModuleList by Attribute or other way, but it is not good solution.
Is there any other way to solve this problem?
I have just created a new silverlight app using Silverlight navigation template. All went well and its working :-)
But the url has an extension of aspx ... can we not remove like asp.net MVC has done?
SilverlightApplication1TestPage.aspx
The next thing that i found strange is how it appends the page name, it uses # symbol like so
SilverlightApplication1TestPage.aspx#Home
I thought it would be more natural to do this (also like asp.net mvc does)
SilverlightApplication1TestPage/Home
SilverlightApplication1TestPage/About
Is there a kind of work around or updated tamplete of some kind
Or its not possible?
Thanks
I'm using Silverlight with Asp.Net MVC and here is a sample URL: http://localhost:37920/#/AdvancedSearch. When I was using straight Asp.Net then yeah I had .aspx files in it. It Still isn't what you really want but gets you closer maybe.
The bottom line is: no. To simplify it everything in a URL prior to the # belongs to the server and everything after the # belongs to the client.
A Silverlight application exists entirely with with in a single URL (page) from the servers perspective. When you use the Silverlight navigation framework you are moving about within the app inside this single HTML page.
If the # is removed there would be fetches made to the server and the results would replace the existing page, the current SL app will be unloaded to be replaced with the resulting content. Even if that resulting content is the same SL app but directed to a different context it would still unload the app and reload it.
The use # is merely a means for navigation within the Silverlight app to be tracked within the browsers navigation history. The browsers own back button will then operate in a way that doesn't surprise the user.
THanks everyone for comments, it got me thinking... and i think i have fixed it.. and found a solutions using asp.net 4.0 routing...
Add a global file to the asp.net project and then add this to application start
// Code that runs on application startup
RouteTable.Routes.MapPageRoute("SilverlightRoute",
"MyApp",
"~/SilverlightApplication1TestPage.aspx");