Skip to content
Loading
Modal Pop Up in ASP.Net  
  •   
  •   
  •   
  • 'text/javascript'>  
  • function openModal() {  
  • $('[id*=myModal]').modal('show');  
  • }  
  •   
    1. protected void lnkbtnSalesLead_Click(object sender, EventArgs e)  
    2. {  
    3. string sQuery = string.Empty;  
    4. string sError = string.Empty;  
    5. DataTable dtbl = new DataTable();  
    6. ImageButton Imgbtn = sender as ImageButton;  
    7. GridViewRow gvrow = lnkbtnSalesLead.NamingContainer as GridViewRow;  
    8. //hfUniqueId.Value = gvLead.DataKeys[gvrow.RowIndex].Value.ToString();  
    9. //Label sUserId = (Label)gvrow.FindControl("lblLeadId");  
    10. try  
    11. {  
    12. divModal.Visible = true;  
    13. sQuery = " My Database query";  
    14. objHelper.CreateConnection("Connect");  
    15. if (objHelper.FillDataTableByQueryString(ref dtbl, ref sError, sQuery) == true)  
    16. {  
    17. if (dtbl.Rows.Count > 0)  
    18. {  
    19. gvLead.DataSource = dtbl;  
    20. gvLead.DataBind();  
    21. ClientScript.RegisterStartupScript(this.GetType(), "Pop""openModal();"true);  
    22. }  
    23. }  
    24. else  
    25. {  
    26. Page.Controls.Add(new LiteralControl(""));  
    27. return;  
    28. }  
    29. }  
    30. catch (Exception ex)  
    31. {  
    32. Page.Controls.Add(new LiteralControl(""));  
    33. return;  
    34. }  
    35. }  

    4 Replies

    Know the answer? Post it — somebody with the same question will find it here.