asp.net model popup extender – Education Career Blog

I am using ajax model popup extender in my asp.net page. From my page , on click of Save button , i popup panel using model popup extender.

If i cause postback from model popup , my backend (asp.net) form controls are coming front (ie) in the panel.

Here is my code snippet,

<form id="form1" runat="server">
                        <asp:ScriptManager ID="ScriptManager1" runat="server">
                        </asp:ScriptManager>
                        <asp:UpdatePanel ID="up_Save" runat="server">
                          <ContentTemplate>
                            <div>                               
                              <table border="0" cellpadding="2" cellspacing="2" width="100%">                                                
                                <tr>
                                  <td align="center" colspan="4">
                                    <asp:Button ID="btn_Save" runat="server"  Text="Save" Width="15%" OnClick="btn_Save_Click" />                                                                   

                                    </td>
                                </tr>
                              </table>                              
                            </div>
                          </ContentTemplate>                          
                        </asp:UpdatePanel>                 

                        <cc1:ModalPopupExtender ID="BarrierRelayPopup" runat="server" PopupControlID="PopUp_Panel" TargetControlID="hiddenfield" CancelControlID="btn_Cancel_PopUp">
                        </cc1:ModalPopupExtender>
                        <asp:HiddenField ID="hiddenfield" runat="server" />

                        <asp:Panel runat="server" ID="PopUp_Panel" Width="50%" Height="30%" BackColor="Gainsboro" BorderStyle="Groove" >
                          <asp:UpdatePanel runat="server" ID="PopUp">
                            <ContentTemplate>
                              <table>
                                <tr>
                                  <td align="left">
                                    <asp:Label ID="lbl_Heading" runat="server" Text="Select Relay and Barrier :"></asp:Label>
                                  </td>
                                </tr>
                                <tr>
                                  <td>
                                    <B_R:Barrier_Relay ID="Barrier_Relay" runat="server"/>
                                  </td>
                                </tr>
                                <tr>
                                  <td align="center">
                                    <asp:Button ID="btn_OK" runat="server" Width="60px"  Text="OK" OnClick="btn_OK_Click" /> &nbsp; <asp:Button ID="btn_Cancel_PopUp" runat="server" Width="60px" Text="Cancel" OnClick="btn_Cancel_PopUp_Click"/>
                                  </td>
                                </tr>
                              </table>
                            </ContentTemplate>
                          </asp:UpdatePanel>
                        </asp:Panel>
                      </form>             

Can anybody help me in this.

,

If I understand you right I think what you want to do is wrap the controls inside the modal in an updatepanel. This will prevent the modal from closing if you need to do a postback from within the popup.

Leave a Comment