Click here to Skip to main content
15,311,104 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi.
I have Problem by UpdatePanel.
Please help me.
my error:
SQL
Cannot unregister UpdatePanel with ID '' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
    Parameter name: updatePanel



[ArgumentException: Cannot unregister UpdatePanel with ID '' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel]
System.Web.UI.PageRequestManager.UnregisterUpdatePanel(UpdatePanel updatePanel) +839559
System.Web.UI.UpdatePanel.OnUnload(EventArgs e) +2948636
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +160
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Page.UnloadRecursive(Boolean dispose) +24
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11297582
System.Web.UI.Page.ProcessRequest() +119
System.Web.UI.Page.ProcessRequest(HttpContext context) +167
ASP.controls_membership_request_default_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\localsamab\0ade0bce\7cf82176\App_Web_xbnt5ojs.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +597
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266

I add a Scrip Manager to Master Page.
Other parts are working properly but this part have Error.



Posted

you should add the UpdatePanel_Unload to the OnUnload event of the UpdatePanel:
C#
<asp:UpdatePanel ID="UpdatePanel1" runat="server" OnUnload="UpdatePanel_Unload">


In Code behind :
C#
protected void UpdatePanel_Unload(object sender, EventArgs e) {
    MethodInfo methodInfo = typeof(ScriptManager).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
        .Where(i => i.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")).First();
    methodInfo.Invoke(ScriptManager.GetCurrent(Page),
        new object[] { sender as UpdatePanel });
}



for more details for cause of this error refer :
http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx[^]
hope this helps.
   
v3
Comments
Sandeep Mewara 29-May-12 2:00am
   
5!
member60 11-Jun-12 0:03am
   
thank you Sandeep
VJ Reddy 9-Jun-12 20:43pm
   
Good answer. 5!
member60 11-Jun-12 0:02am
   
thank you VJ
Praveen_P 24-Oct-14 5:18am
   
+5
its not working
   
I get 'System.Reflection.MethodInfo[]' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Reflection.MethodInfo[]' could be found
   
Comments
CHill60 23-Oct-14 4:30am
   
Not a solution. If you want to respond to the poster use the "Have a Question or Comment?" link next to the appropriate post

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900