How do you use ScriptManagerProxy in a custom ASP.NET control?

Emil D picture Emil D · Apr 20, 2010 · Viewed 7.6k times · Source

Basically, I have created a custom control that uses an UpdatePanel, and as I understand it I need to use a ScriptManagerProxy to make it work ( since there should only be one ScriptManager per page, and is is declared in my .aspx page ).So, how do you use this beastie, is it just a matter of adding:

<asp:ScriptManagerProxy ID="ScriptManagerProxy3" runat="server">
</asp:ScriptManagerProxy>

to your control, or is there more to it? Could anyone please post a link to a good tutorial/example set? I tried googling for this, but I didn't find anything useful...

Answer

Rob Windsor picture Rob Windsor · Apr 20, 2010

Your control does not require a ScriptManagerProxy to work. You would only need a ScriptManagerProxy if you needed to add a ServiceReference or ScriptReference in your control. The ScriptManagerProxy allows you to do this without having to have knowledge about the page that is going to host your control. When the page is rendered, the properties of the ScriptManagerProxy controls are merged with those of the ScriptManager control on the host page.