Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I have a nested gridview on a popup panel. This is the code of the panel:
ASP.NET
<asp:ModalPopupExtender ID="popupApplic" TargetControlID="lnkFake2" CancelControlID="btnApplCancel" 
        PopupControlID="pnlEditAppl" BackgroundCssClass="modalBackground" DropShadow="true"
        runat="server">

<asp:Panel ID="pnlEditAppl" runat="server" CssClass="modalPopupWide" align="center" style="overflow-x:scroll;">
    <table class="mTable">
            <tbody><tr>
                <td>
                    <asp:Label ID="lblAreaDescr" runat="server" Text="Area:">
                </td>
                <td>
                    <asp:TextBox ID="txtAreaDescr" runat="server" CssClass="form-control">
                </td>
            </tr>    
            <tr>
                <td>
                    <asp:Label ID="lblNo" runat="server" Text="No: ">
                </td>
                <td>
                    <asp:TextBox ID="txtNo" runat="server" CssClass="form-control">
                </td>
            </tr>
    </tbody></table>
       <br>  
       <asp:GridView ID="gv1" runat="server" AutoGenerateColumns="false" 
        Visible="true" AllowPaging="True" PageSize="5" ShowFooter="true"
        CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
           OnPageIndexChanging="gv1_PageIndexChanging"
              OnRowCancelingEdit ="gv1_RowCancelingEdit" 
              OnRowDeleting ="gv1_RowDeleting" 
              OnRowEditing="gv1_RowEditing" 
              OnRowUpdating="gv1_RowUpdating" 
              OnRowCommand="gv1_RowCommand">
           <columns>
             <asp:TemplateField HeaderText="S/N">
                <itemtemplate>
                    <asp:Label ID="lblrownum" runat="server" Text='<%#Eval("rownum") %>'>
                
            
            <asp:TemplateField HeaderText="ID">
                <itemtemplate>
                    <asp:Label ID="lblTypeID" runat="server" Text='<%#Eval("TypeID") %>'>
                
            

            <asp:TemplateField HeaderText="Description">
                <itemtemplate>
                    <asp:Label ID="lblDescr" runat="server" Text='<%#Eval("TypeDescr") %>'>
                
                <edititemtemplate>
                    <asp:TextBox ID="txtDescr" runat="server" Text='<%#Eval("TypeDescr") %>'>
                
                <footertemplate>
                    <asp:TextBox ID="txtAddDescr" runat="server">
                
            
              <asp:TemplateField >
              <itemtemplate>
                 <asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" />                   
              
              <edititemtemplate>
                  <asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update" />
                  <asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" />
              
                  <footertemplate>
                      <asp:Button ID="btnInsert" runat="server" Text="Insert" CommandName="Insert" /> 
                                               
            
            <asp:TemplateField>
                <itemtemplate>
                     <span>
                    <asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="Delete">
                         </span>
                
                <edititemtemplate>
                     <span>
                    <asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="Delete">
                     </span>
                
             

             
       <br>      
          <table>
        <tbody><tr>
            <td>
                <asp:Button ID="btnApplSave" runat="server" Text="Update" OnClick="btnApplSave_Click" ValidationGroup="valPnlAppl" CssClass="btn btn-default"/>
            </td>
            <td> </td>
            <td>
                <asp:Button ID="btnApplCancel" runat="server" Text="Cancel" CssClass="btn btn-default"/>
            </td>
        </tr>
    </tbody></table>
    
<asp:LinkButton ID="lnkFake2" runat="server">


The problem is when a have a postback action on the gridview (insert/update/delete) the popup panel closes.

How can I prevent that? I would appreciate any kind of help, thank you.

What I have tried:

I added the following:

ASP.NET
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <contenttemplate>
        .....gridview code....

           <triggers>
               <asp:AsyncPostBackTrigger ControlID="gv1"/>
Posted
Updated 2-Nov-16 20:56pm
v2
Comments
Suvendu Shekhar Giri 3-Nov-16 3:00am    
How about opening the popup once again from code after the relevant postback?
Karthik_Mahalingam 4-Nov-16 10:51am    
you have got a reply
Chriz12 3-Nov-16 3:29am    
Thank you that works!You can post it as the solution if you like.
Karthik_Mahalingam 4-Nov-16 10:51am    
Always use  Reply   button to post comments/query to the concerned user, so that the user gets notified and respond to your text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900