AJAX Modal Popup page not unlocked after hide

Posted on 2008-11-12
Last Modified: 2012-05-05
I have a GridView with a button on each row when clicked displays a modal popup panel with values based upon the row selected. I have the ModalPopupExtender working fine (thanks to some wonderful work from but the problem I have is that when I save the data, the page is not unlocked. The database is updated and the modal popup goes away, but the background page remains locked. Any ideas on how to resolve this?

<asp:Panel ID="pnlTradingPartnerSetup" runat="server" GroupingText="Trading Partner Setup"


                <asp:Table ID="tblTPS" runat="server" EnableViewState="false" Width="1000px" CellSpacing="0"

                    CellPadding="0" GridLines="Both">


                        <asp:TableCell Width="145px">

                            <asp:TextBox ID="txtTPS_TradingPartnerNbr_QBE" runat="server" BorderStyle="None"

                                BorderColor="Black" Width="99%" /></asp:TableCell>

                        <asp:TableCell Width="193px">

                            <asp:TextBox ID="txtTPS_TradingPartnerName_QBE" runat="server" BorderStyle="None"

                                BorderColor="Black" Width="99%" /></asp:TableCell>

                        <asp:TableCell Width="240px">

                            <asp:TextBox ID="txtTPS_Description_QBE" runat="server" BorderStyle="None" BorderColor="Black"

                                Width="98%" /></asp:TableCell>

                        <asp:TableCell Width="95px">

                            <asp:DropDownList ID="ddlTPS_Enabled_QBE" runat="server" Width="99%">

                                <asp:ListItem Text="" Value="" />

                                <asp:ListItem Text="Active" Value="Y" />

                                <asp:ListItem Text="InActive" Value="N" />



                        <asp:TableCell Width="145px">

                            <asp:TextBox ID="txtTPS_InboundDirectory_QBE" runat="server" BorderStyle="None" BorderColor="Black"

                                Width="99%" /></asp:TableCell>

                        <asp:TableCell Width="145px">

                            <asp:TextBox ID="txtTPS_OutboundDirectory_QBE" runat="server" BorderStyle="None"

                                BorderColor="Black" Width="99%" /></asp:TableCell>



                <asp:UpdatePanel ID="updatePanelTPS" runat="server" UpdateMode="Conditional">


                        <asp:Panel runat="server" ScrollBars="None" Height="650px" Width="1020px">

                            <asp:GridView ID="grdTPS_TradingPartners" runat="server" Width="1000px" GridLines="Both"

                                AutoGenerateColumns="false" CssClass=".GVFixedHeader" BorderStyle="Solid" BorderColor="Black"


                                <HeaderStyle CssClass="Grid_HeaderStyle" VerticalAlign="Top" HorizontalAlign="Center" />

                                <AlternatingRowStyle CssClass="Grid_AlternatingRowStyle" />

                                <RowStyle CssClass="Grid_RowStyle" />


                                    <asp:BoundField DataField="trading_partner_id" ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol" />

                                    <asp:BoundField DataField="trading_partner_number" HeaderText="Partner Number" ItemStyle-Width="150px" />

                                    <asp:BoundField DataField="trading_partner_name" HeaderText="Partner Name" ItemStyle-Width="200px" />

                                    <asp:BoundField DataField="description" HeaderText="Description" ItemStyle-Width="250px" />

                                    <asp:TemplateField ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center">



                                            <asp:CheckBox ID="chkTPS_Enabled" runat="server" Checked='<%# Eval("active").ToString()=="Y"?true:false %>' Enabled="false" />



                                    <asp:BoundField DataField="inbound_directory" HeaderText="Inbound Directory" ItemStyle-Width="150px" />

                                    <asp:BoundField DataField="outbound_directory" HeaderText="Outbound Directory" ItemStyle-Width="150px" />



                                            <asp:LinkButton ID="btnEditTridingPartner" runat="server" Text="Edit" CommandName="Select" />








                <br />

                <table width="1000px">

                    <tr align="right">


                            <asp:Button ID="btnSearch_TradingPartner" runat="server" Text="Search" OnClick="btnSearch_TradingPartner_Click" CssClass="button" />

                            <asp:Button ID="btnTPS_AddNew" runat="server" Text="AddNew" CssClass="button" OnClick="btnTPS_AddNew_Click" />





            <asp:Panel ID="pnlEditTradingPartner" runat="server" Style="display: none" CssClass="modalPopup">

                <dir style="margin: 10px">

                    <asp:UpdatePanel runat="server" ID="UpdatePanel_ModalEditTradingPartner" RenderMode="Inline"



                            <asp:Button ID="btnShowTPSPopup" runat="server" Style="display: none" />

                            <cc1:ModalPopupExtender runat="server" ID="ModalPopupEditTradingPartner" TargetControlID="btnShowTPSPopup"

                                PopupControlID="pnlEditTradingPartner" BackgroundCssClass="modalBackground" CancelControlID="btnTPS_Cancel"/>

                            <div align="center" runat="server">

                                <asp:Label ID="lblPopupHeader" runat="server" Width="100%" Font-Bold="true" />


                            <hr />

                            <table width="100%">


                                    <td><asp:Label ID="Label1" runat="server" Text="Partner Number" EnableViewState="false" /></td>

                                    <td><asp:TextBox runat="server" ID="txtTPS_TradingPartnerNumber_Edit" MaxLength="15" /></td>



                                    <td><asp:Label ID="Label2" runat="server" Text="Partner Name" EnableViewState="false" /></td>

                                    <td><asp:TextBox runat="server" ID="txtTPS_TradingPartnerName_Edit" MaxLength="50" Columns="20" /></td>



                                    <td><asp:Label ID="Label3" runat="server" Text="Description" EnableViewState="false" /></td>

                                    <td><asp:TextBox runat="server" ID="txtTPS_Description_Edit" Columns="25" /></td>



                                    <td><asp:Label ID="Label4" runat="server" Text="Inbound Directory" EnableViewState="false" /></td>

                                    <td><asp:TextBox runat="server" ID="txtTPS_InboundDirectory_Edit" Columns="30" /></td>



                                    <td><asp:Label ID="Label5" runat="server" Text="Outbound Directory" EnableViewState="false" /></td>

                                    <td><asp:TextBox runat="server" ID="txtTPS_OutboundDirectory_Edit" Columns="30" /></td>



                                    <td><asp:HiddenField ID="hfTPS_Trading_Partner_ID" runat="server" /></td>

                                    <td><asp:CheckBox ID="chkTPS_Active_Edit" runat="server" Text="Active" /></td>



                            <hr />

                            <div align="center">

                                <asp:Button runat="server" ID="btnTPS_Save" Text="Save" OnClick="btnSave_TradingPartner_Click" CausesValidation="true" />

                                <asp:Button runat="server" ID="btnTPS_Cancel" Text="Cancel" CausesValidation="false" />






  protected void btnSave_TradingPartner_Click(object sender, EventArgs e)


        //Get Empty Dataset with one blank record to build XML

        DataTable dt = Initialize_Trading_Partner_Table();

        //Set Values to update

        dt.Rows[0]["trading_partner_id"] = this.hfTPS_Trading_Partner_ID.Value;

        dt.Rows[0]["trading_partner_number"] = this.txtTPS_TradingPartnerNumber_Edit.Text;

        dt.Rows[0]["trading_partner_name"] = this.txtTPS_TradingPartnerName_Edit.Text;

        dt.Rows[0]["description"] = this.txtTPS_Description_Edit.Text;

        dt.Rows[0]["inbound_directory"] = this.txtTPS_InboundDirectory_Edit.Text;

        dt.Rows[0]["outbound_directory"] = this.txtTPS_OutboundDirectory_Edit.Text;

        if (chkTPS_Active_Edit.Checked)


            dt.Rows[0]["active"] = "Y";




            dt.Rows[0]["active"] = "N";


        //Create XML from Recordset

        string trading_partner_xml = clsDataUtility.CreateXML(dt, true);

        //Save Data



        //Hide model Popup



Open in new window

Question by:drawalegna
    LVL 22

    Accepted Solution

    Try moving the ModalPopupExtender outside of pnlEditTradingPartner.

    Author Comment

    Thanks a bunch. I had tried that but got the following error.
          An extender can't be in a different UpdatePanel than the control it extends.

    I moved the pnlEditTradingPartner panel inside the UpdatePanel and moved the ModalPopupExtender  outside the pnlEditTradingPartner but still within the UpdatePanel and it worked. I will award you the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now