Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


AJAX Modal Popup page not unlocked after hide

Posted on 2008-11-12
Medium Priority
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 http://www.mattberseth.com/) 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

prairiedog earned 2000 total points
ID: 22944263
Try moving the ModalPopupExtender outside of pnlEditTradingPartner.

Author Comment

ID: 22944424
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

564 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