In Link Button Click To Open Modal Correctly
But click close button not close...what is the reason i dont know..the close button not triggered....
My Code...
- <asp:LinkButton ID="lnkbtnSalesLead" runat="server" Text="10" Font-Size="16px" OnClick="lnkbtnSalesLead_Click"></asp:LinkButton><br />
- <div class="container" id="divModal" runat="server">
- <!-- Modal -->
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title">Sales Lead Details</h4>
- </div>
- <div class="modal-body">
- <asp:GridView ID="gvLead" runat="server" AutoGenerateColumns="False" CssClass="table table-bordered table-condensed">
- <Columns>
- <asp:TemplateField HeaderText="Emp Name">
- <ItemTemplate>
- <asp:Label ID="lblEmpName" runat="server" Text='<%# Bind("EmpName") %>'></asp:Label>
- </ItemTemplate>
- <ItemStyle HorizontalAlign="Center" />
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Client Code">
- <ItemTemplate>
- <asp:Label ID="lblCustomerName" runat="server" Text='<%# Bind("CustomerName") %>'></asp:Label>
- </ItemTemplate>
- <ItemStyle Horizontal />
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Sales Lead Stage">
- <ItemTemplate>
- <asp:Label ID="lblSalesLeadStage" runat="server" Text='<%# Bind("SalesLeadStage") %>'></asp:Label>
- </ItemTemplate>
- <ItemStyle HorizontalAlign="Center" />
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Meeting Date">
- <ItemTemplate>
- <asp:Label ID="lblMeetingDate" runat="server" Text='<%# Bind("MeetingDate") %>'></asp:Label>
- </ItemTemplate>
- <ItemStyle Horizontal />
- </asp:TemplateField>
- </Columns>
- <PagerStyle HorizontalAlign="Center" CssClass="GridPager" />
- <HeaderStyle CssClass="grdHead" />
- <RowStyle BackColor="White" />
- <FooterStyle BackColor="White" ForeColor="#000066" />
- </asp:GridView>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script type='text/javascript'>
- function openModal() {
- $('[id*=myModal]').modal('show');
- }
- </script>
- protected void lnkbtnSalesLead_Click(object sender, EventArgs e)
- {
- string sQuery = string.Empty;
- string sError = string.Empty;
- DataTable dtbl = new DataTable();
- ImageButton Imgbtn = sender as ImageButton;
- GridViewRow gvrow = lnkbtnSalesLead.NamingContainer as GridViewRow;
-
-
- try
- {
- divModal.Visible = true;
- sQuery = " My Database query";
- objHelper.CreateConnection("Connect");
- if (objHelper.FillDataTableByQueryString(ref dtbl, ref sError, sQuery) == true)
- {
- if (dtbl.Rows.Count > 0)
- {
- gvLead.DataSource = dtbl;
- gvLead.DataBind();
- ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openModal();", true);
- }
- }
- else
- {
- Page.Controls.Add(new LiteralControl("<script>alert('" + sError + "');</script>"));
- return;
- }
- }
- catch (Exception ex)
- {
- Page.Controls.Add(new LiteralControl("<script>alert('" + ex.Message.Replace("'", "").Replace("\n", "").Replace("\r", "") + "');</script>"));
- return;
- }
- }