Vikas Singh

Vikas Singh

  • 1.3k
  • 410
  • 14.9k

I wan to open popup on click button

Jan 2 2021 10:05 AM
Hello sir i want to open popup on click button first check condition and then open popup
 
here are code for it.
 
This is button where i want to open popup
  1. <asp:Button runat="server" ID="btnForwardforvalidation" Text="Forward for Validation" CssClass="btn btn-primary"  
  2. OnClick="btnForwardforvalidation_Click" />  
This is model popup
  1. <!-- Modal Popup -->  
  2. <div id="MyPopup" class="modal fade" role="dialog">  
  3. <div class="modal-dialog">  
  4. <!-- Modal content-->  
  5. <div class="modal-content">  
  6. <div class="modal-header">  
  7. <div class="col-md-8">  
  8. <h3 style="color: green">Send Request For Approval</h3>  
  9. </div>  
  10. <div class="col-md-4">  
  11. <button type="button" class="close" data-dismiss="modal">  
  12. ×</button>  
  13. </div>  
  14. <h4 class="modal-title"></h4>  
  15. </div>  
  16. <div class="modal-body">  
  17. <div class="row">  
  18. <div class="col-md-2">  
  19. <asp:Label runat="server">Select Employee : <span style="color:red">*</span> </asp:Label>  
  20. </div>  
  21. <div class="col-md-4">  
  22. <asp:DropDownList runat="server" ID="ddlemplist" CssClass="form-control select2" Width="100%"></asp:DropDownList>  
  23. <asp:HiddenField runat="server" ID="hidchkemplist" />  
  24. <asp:CustomValidator runat="server" ID="cvmodulelist" ClientValidationFunction="ValidateModuleList"  
  25. ErrorMessage="Please Select Atleast one Module" ValidationGroup="ab" ForeColor="#cc0000" Display="none"></asp:CustomValidator>  
  26. </div>  
  27. <div class="col-md-2">  
  28. <asp:Label runat="server">Meeting Date : <span style="color:red">*</span> </asp:Label>  
  29. </div>  
  30. <div class="col-md-4">  
  31. <asp:TextBox runat="server" ID="txtmeetingdate" type="Date" CssClass="form-control"></asp:TextBox>  
  32. <asp:RequiredFieldValidator runat="server" ControlToValidate="txtmeetingdate" ErrorMessage="Meeting Date is Required !" Display="Dynamic" ValidationGroup="ab">  
  33. </asp:RequiredFieldValidator>  
  34. </div>  
  35. <div class="clearfix"></div>  
  36. <div class="col-md-12">  
  37. <asp:Label runat="server" ID="lblmsg" Visible="false" ForeColor="Red"></asp:Label>  
  38. </div>  
  39. </div>  
  40. <div class="clearfix"></div>  
  41. <br />  
  42. <div class="row">  
  43. <div class="col-md-12" align="center">  
  44. <asp:Button runat="server" ID="btnSendRequest" Text="Send Request For Approval" CssClass="btn btn-primary" OnClick="btnSendRequest_Click"  
  45. ValidationGroup="ab"></asp:Button>  
  46. <asp:ValidationSummary runat="server" ShowMessageBox="false" ShowSummary="true" ValidationGroup="ab" />  
  47. </div>  
  48. </div>  
  49. </div>  
  50. <div class="modal-footer">  
  51. <button type="button" class="btn btn-danger" data-dismiss="modal">  
  52. Close  
  53. </button>  
  54. </div>  
  55. </div>  
  56. </div>  
  57. </div>  
  58. <!-- Modal Popup -->  
and this is my onclick event
  1. protected void btnForwardforvalidation_Click(object sender, EventArgs e)  
  2. {  
  3. string check = "false";  
  4. foreach (GridViewRow grd in GRDPanelMeet.Rows)  
  5. {  
  6. CheckBox chkselect = (CheckBox)grd.FindControl("chkselect");  
  7. if (chkselect.Checked)  
  8. {  
  9. check = "true";  
  10. }  
  11. }  
  12. if (check == "false")  
  13. {  
  14. ScriptManager.RegisterStartupScript(thisthis.GetType(), "popup""alert('Msg|Please select atleast one checkbox !');"true);  
  15. }  
  16. else  
  17. {  
  18. //Here I want to open popup  
  19. }  
  20. }  

Answers (1)