c# - updatePanel in Griview ItemTemplate has issue on postback -
in griditemtemplate , have update panel , check box ,
<itemtemplate> <asp:updatepanel runat="server" id="upchkoption"> <contenttemplate> <asp:checkbox runat="server" id="chkoption" autopostback="true" oncheckedchanged="chkoption_checkchanged"> </contenttemplate> </asp:updatepanel> </itemtemplate> first time running has no error , after postback , got error
cannot unregister updatepanel id 'upchkoption' since not registered scriptmanager. might occur if updatepanel removed control tree , later added again, not supported. parameter name: updatepanel how can solve ?
add updatepanel_unload onunload event of updatepanel:
<asp:updatepanel id="upchkoption" runat="server" onunload="updatepanel_unload"> add 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 updatepanel }); } adding/removing updatepanels dynamicaly page
cannot-unregister-updatepanel-since-it-was-not-registered-with-the-scriptmanager-error
Comments
Post a Comment