Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application.

With the templates coming out of VS2008 when you create a Silverlight application, a ASP.NET Web project is created for you to test your Silverlight app that adds the control into a ASPX page and a HTML page. Many developers will use the power of ASP.NET for server side processing and add a few ASP.NET controls on the page where the Silverlight control is.

There is when the user will find the problem about mixing up server side controls and Silverlight, the server side controls will cause postbacks that will refresh the Silverlight control. To avoid that problem, the developer may want to use MS ASP.NET AJAX to avoid the server side controls from doing a postback using the UpdatePanel. For this to work there is a simple modification that you need to do at the page where you are hosting the Silverlight control.

First drag and drop the ScriptManager on the page.

image

Second replace the location of the Silverlight.js file from:

<script type="text/javascript" src="Silverlight.js"></script>

 

To be hosted inside the ScriptManager like this:

<asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
           <asp:ScriptReference Path="Silverlight.js" />
          </Scripts>
         </asp:ScriptManager>

Now all the controls hosted inside the UpdatePanels should work, remember not to add an UpdatePanel to wrap the Silverlight control.

Happy Silverlighting.

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Published Sunday, August 30, 2009 7:45 PM by albertpascual
Filed under: ,

Comments

# Twitter Trackbacks for Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application. - Al Pascual ASP.NET Blog [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application. - Al Pascual ASP.NET Blog         [asp.net]        on Topsy.com

# Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application

Monday, August 31, 2009 7:03 AM by WebDevVote.com

You are voted (great) - Trackback from WebDevVote.com

# re: Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application.

Sunday, March 21, 2010 10:41 PM by Rollo

Give please. Music is essentially useless, as life is. Help me! Need information about: Share trading software india. I found only this - <a href="leadership.nlada.org/.../beginner-share-trading">beginner share trading</a>. Share trading, the exchange of the society vacationers on the different funds may examine therefore and may be notified to zero. Explain that sequence setup engages your news ideas, share trading. With respect :-), Rollo from Britain.

# re: Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application.

Thursday, August 18, 2011 12:33 PM by Melvina

With all these silly websites, such a great page keeps my intenert hope alive.

# re: Mixing Silverlight and MS ASP.NET AJAX 3.5 in the same web application.

Friday, August 19, 2011 12:30 PM by Johnetta

I really couldn't ask for more from this aritlce.

Leave a Comment

(required) 
(required) 
(optional)
(required)