checkbox in the panel control under control of one page

来源:互联网 发布:淘宝号怎么复制 编辑:程序博客网 时间:2024/05/02 13:11

If you have one page has the updatepanel inside and want to use checkbox with child update panel in the child control. You will get the loading screen. What you need to stop the forever loading, you should tell the parent page the child update panel is done. Example:


Parent page:

<asp:content id="contentManageLibrary" contentplaceholderid="ContentPlaceHolder1"
    runat="server">
    <div id="manage_librarytab">
        <asp:UpdatePanel ID="upManageLibrary" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <ajaxToolkit:TabContainer ID="tabNavigation" runat="server" Width="100%" ActiveTabIndex="0"
                    AutoPostBack="False" OnActiveTabChanged="tabNavigation_ActiveTabChanged" OnClientActiveTabChanged="loadActiveTabChanged">
                    <ajaxToolkit:TabPanel ID="tpCoursePackages" runat="server" ToolTip="Click here to view/edit Manage Library Settings.">
                        <HeaderTemplate>
                            <asp:Image ID="imgCourse" runat="server" ImageUrl="~/Resource/Images/1.png" />
                            Course Packages
                        </HeaderTemplate>
                        <ContentTemplate>
                            <div class="gridContainer">
                                <uc2:CoursePackages ID="uc Packages" runat="server" />
                            </div>
                        </ContentTemplate>
                    </ajaxToolkit:TabPanel>
              
            </ContentTemplate>
        </asp:UpdatePanel>
        <ajaxToolkit:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server"
            TargetControlID="upManageLibrary">
            <Animations>
                    <OnUpdating>
                        <Parallel duration="0">
                            <%-- place the update progress div over the gridview control --%>
                            <ScriptAction Script="onUpdating();" />  
                         </Parallel>
                    </OnUpdating>
                    <OnUpdated>
                        <Parallel duration="0">
                            <%--find the update progress div and place it over the gridview control--%>
                            <ScriptAction Script="onUpdated();" />
                        </Parallel>
                    </OnUpdated>
            </Animations>
        </ajaxToolkit:UpdatePanelAnimationExtender>
        <div id="updateProgressDiv" class="updateProgress" style="display: none">
            <div align="center" style="margin-top: 23px;" class="updateProgressImg">
                <span class="updateProgressMessage">Loading ...</span>
            </div>
        </div>
    </div>
</asp:content>

In the Child Control:

<asp:Panel ID="pnlAddQuestion" runat="server" Style="display: none;" >
    <asp:UpdatePanel ID="udpInnerUpdatePanel" runat="Server" UpdateMode="Conditional">
        <ContentTemplate>  

 <asp:CheckBox ID="ckbDeclaimer" runat="server" OnCheckedChanged="ckbDeclaimer_CheckedChanged"
                    AutoPostBack="true" />

</ContentTemplate>


In the cs


 protected void ckbDeclaimer_CheckedChanged(object sender, EventArgs e)
        {
            ckbDeclaimerEvent();

   //To avoid the Modal popup closing on server events and hide the loading and tell the parent, the child control has finished the update

System.Web.UI.UpdatePanel upManageLibrary = (System.Web.UI.UpdatePanel)this.Page.FindControl("ctl00$ContentPlaceHolder1$upManageLibrary");
            if (upManageLibrary != null)
            {
                upManageLibrary.Update();
            }


        }


原创粉丝点击