locked
ScriptManager Updatepanel show error RRS feed

  • Question

  • User-1740043572 posted

    Cannot unregister UpdatePanel with ID 'DemoPanel' 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

    Thursday, May 24, 2018 11:28 AM

All replies

  • User-330142929 posted

    Hi Thamu,

    According to your description, I suggest you could  post more details about your code to help me understand your problem.

    If you could post code and error details, it is more easily to give you a solution.

    Look forward to your reply.

     

    Best Regards,

    Abraham

    Friday, May 25, 2018 8:45 AM
  • User409696431 posted

    The error is clear.  Why you are getting that error (why you are removing the UpdatePanel from the control tree, and then adding it back, which is unsupported) is not clear, since you have provided no code or context.

    Saturday, May 26, 2018 12:36 AM
  • User-330142929 posted

    Hi Thamu,

    you should add the UpdatePanel_Unload to the OnUnload event of the UpdatePanel:

    <div id="premain796623">Code Snippets.</div> <div>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnUnload="UpdatePanel_Unload">


    In Code behind :</div>

    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 :

    https://www.codeproject.com/Questions/393396/Cannot-unregister-UpdatePanel-with-ID

    http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx[^]

    If the solution could not solve your problem, please feel free to let us know.


    Best Regards,
    Abraham

    Monday, May 28, 2018 2:28 AM