Add the UpdatePanel_Unload
to the OnUnload
event of the UpdatePanel
:
<asp:UpdatePanel ID="upChkOption" runat="server" OnUnload="UpdatePanel_Unload">
Add this in code behind
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 });
}
Adding/removing UpdatePanels dynamicaly from a page
cannot-unregister-updatepanel-since-it-was-not-registered-with-the-scriptmanager-error