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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -