I am using Ajax Comboboxes in my application. The controls are re-created dynamically on page_load after postback.
I keep receiving this error when selecting an item from the ajax combobox when I run the application.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Script controls may not be registered after PreRender.
My Master_Page…
<form runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1"
runat="server" EnablePageMethods="True">
</asp:ToolkitScriptManager>
My content Page
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
End Sub
I had done the above methods based on other posts but it still does not resolve the issue. I must be missing something simple, I’m hoping so.
How can this error be resolved?
I found out if you are storing AJAX controls in Session or Cache and trying to recreate them on Page_Load you will get the Script control error. FYI, storing Standard asp.net controls in session and recreating works fine.
Here are some links to help better understand the issues.
[Link 1] http://forums.asp.net/t/1649461.aspx
[Link 2] http://www.telerik.com/community/forums/aspnet-ajax/docking/script-controls-may-not-be-registered-after-prerender.aspx
If you are not using ajax controls there may be other reasons such as adding the script manager to the master page.