Open a ModalPopup window on button click in a gridview using asp.net

Open a ModalPopup window on button click in a gridview using asp.net

1.        First we need to add ajaxtoolkit in our solution. So u can download ajaxcontrol toolkit from this link
2.        Add ajax control to yr toolbar
3.        Right click under area of  toolbox
=>choose item



=> Click Browse and navigate to the packages folder that Visual Studio 2012 creates with your source. Something like this: ..\packages\AjaxControlToolkit.7.0123\lib\40\AjaxControlToolkit.

=>open
Write the below code to aspx page
          <form id="form1" runat="server">
        <asp:ScriptManager ID="ddd" runat="server"></asp:ScriptManager>



<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
       <asp: Panel ID="pnlModalDemo" runat="server" CssClass="WhiteBG"  
                       Style="width: 455px; padding: 5px; min-height: 96px; display: none;">
         <table width="100%" style="width: 100%; height: 100%;" cellpadding="0"
                         cellspacing="5">
             <tr style="background-color: #FA1818">
               <td colspan="2" style="color: White; font-weight: bold; font-size: 1.2em; padding: 3px"
                                align="center">Details<asp:LinkButton ID="btnClose" Style="color: white; float: right; text-decoration: none" CommandName="Cancel" runat="server">X</asp:LinkButton>

                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="width: 45%; text-align: center;">
                                <asp:Label ID="LabelValidate" runat="server" />
                            </td>
                        </tr>
                        <asp:Label ID="lblID" runat="server" Visible="false"></asp:Label>
                        <tr>
                            <td align="right">First Name :
                            </td>
                            <td>
                                <asp:TextBox ID="txtFirst" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">LastName :
                            </td>
                            <td>
                                <asp:TextBox ID="txtLast" runat="server" />
                              
                            </td>
                        </tr>
                        <tr>
                            <td align="right">Country:
                            </td>
                            <td>
                               <%-- <asp:TextBox ID="txtCon" runat="server" />--%>
                               <%-- <asp:Label ID="lblCunt" runat="server" Text='<%# Eval("City")%>' Visible = "false"></asp:Label>--%>

                                  <asp:DropDownList ID="DropDownList1"  runat="server">
                             </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">City :
                            </td>
                            <td>
                                <asp:TextBox ID="txtCty" runat="server" />
                            </td>
                        </tr>
                        <tr>

                            <td>
                                <asp:Button ID="btnAdd" Text="Add" runat="server" OnClick="btnAdd_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="width: 45%; text-align: center;">
                                <asp:Label ID="lblresult" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <%-- <td>       
                        <asp:Button ID="btnUpdate" CommandName="Update" runat="server" CssClass="btn btn-info" BorderStyle="None" Font-Size="X-Large" OnClick="btnUpdate_Click" Text="Update" Height="46px" Width="110px" BackColor="#84C639" ForeColor="White" ToolTip="Click here to Register" />
                    </td>--%>
                        </tr>
                    </table>
                    <br />

                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" />
                </asp:Panel>

                <asp:LinkButton ID="lnkFake" runat="server">
                </asp:LinkButton>

                <cc1:ModalPopupExtender ID="mpModalDemo" runat="server" PopupControlID="pnlModalDemo"
                    TargetControlID="lnkFake" BackgroundCssClass="modalpopup" BehaviorID="btnAdd"
                    CancelControlID="btnCancel">
                </cc1:ModalPopupExtender>

            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />

            </Triggers>
        </asp:UpdatePanel>








Comments

Popular posts from this blog

Kendo Control(Dynamics)

Override Authorize Filters in MVC

Form Validation