whwn i click the button in modal popup my modal pop up dialog box is automatically close.actualluy i generate otp in my project. so when i clicked the generate otp bnutton this modal popup is closing. i dont to close my pop up right now. it should be remain until my all process should complete
<script src="assets/js/checkotp.js"></script>
<script type="text/javascript">
$(document).on("click",".menu",function(){
$("#myModal").modal("show")
})
</script>
<script type="text/javascript">
$(document).on('click', '#btnsubmit', function (event)
{
event.preventDefault();
var $modal = $('#myModal');
$modal.find('#btnok').modal("show")
});
</script>
<div id="myModal" class="modal fade" data-backdrop="static" data-keyboard="false" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button id="btnclose" type="button" class="close" data-dismiss="modal" aria-disabled="false" aria-hidden="true">×</button>
<h1 class="modal-title panel-title" id="Modalsearch"><b><center>Contact</center></b></h1>
</div>
<div class="modal-body"><center>
<asp:TextBox ID="txtname" CssClass="form-control" Width="300" placeholder="Your Name" CausesValidation="true" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ValidationGroup="NeededForValidate" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator><br />
<asp:TextBox ID="txtemail" CssClass="form-control" Width="300" placeholder="Your Email" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ErrorMessage="*" ValidationGroup="NeededForValidate" ControlToValidate="txtemail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator><br />
<asp:DropDownList ID="ddlcontent" CssClass="form-control" runat="server" Width="300">
<asp:ListItem Value="post">Select Plan</asp:ListItem>
<asp:ListItem Value="post">PostPaid</asp:ListItem>
<asp:ListItem Value="brwl">Broadband with LandLine</asp:ListItem>
<asp:ListItem Value="brwol">Broadband without LandLine</asp:ListItem>
<asp:ListItem Value="ILL">ILL</asp:ListItem>
<asp:ListItem Value="tollfree">Tollfree Nos</asp:ListItem>
<asp:ListItem Value="PRI">PRI</asp:ListItem>
</asp:DropDownList><br />
<asp:TextBox ID="txtcity" CssClass="form-control" Width="300" placeholder="City" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txtmob" CssClass="form-control" Width="300" MaxLength="10" onkeypress="return isNumberKey(event)" placeholder="Your Contact Nunmber" CausesValidation="true" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtmob" runat="server" ValidationGroup="NeededForValidate" ErrorMessage="*"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="btnsubmit" class="btn btn-warning" OnClick="btnsubmit_Click" ValidationGroup="NeededForValidate" runat="server" Text="Generate OTP" /><br />
<asp:TextBox ID="txtOTP" class="btn" MaxLength="4" Width="100" onkeyup="return Check()" Visible="false" placeholder="Enter OTP" runat="server"></asp:TextBox>
<asp:Button ID="btnok" class="btn btn-success" Visible="false" OnClick="btnok_Click" runat="server" Text="Confirm" />
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
</div>
</div>
</div>
</div>
<ajax:ModalPopupExtender ID="mpesubmit" runat="server" TargetControlID="btnDummy" PopupControlID="myModal" BackgroundCssClass="modalBackground"></ajax:ModalPopupExtender>
try
{
common load = new common();
//For generating OTP
Random r = new Random();
string OTP = r.Next(1000, 9999).ToString();
string Number = txtmob.Text;
string Message = "Your One Time Password is " + OTP + ". Do not share this with anyone for security reasons.";
string URL = "http://pay4sms.in/sendsms/?token=d9279885a4ceee392df8cf4208d0fc78&credit=3&sender=RADTEC&message=" + Message + "&number=" + Number + "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string results = sr.ReadToEnd();
sr.Close();
txtname.Visible = false;
txtemail.Visible = false;
txtmob.Visible = false;
txtcity.Visible = false;
ddlcontent.Visible = false;
txtOTP.Visible = true;
btnok.Visible = true;
string to = txtemail.Text; //To address
string from = "samasp27@gmail.com"; //From address
MailMessage message = new MailMessage(from, to);
string mailbody = "You like to book New Connection " + ddlcontent.SelectedItem.ToString();
message.Subject = "Get Your New Connection";
message.Body = mailbody;
//message.BodyEncoding = Encoding.UTF8;
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Gmail smtp
System.Net.NetworkCredential basicCredential1 = new
System.Net.NetworkCredential("samasp27@gmail.com", "9884289554");
//
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicCredential1;
client.Send(message);
//Store the OTP in session to verify in next page.
//If you want to verify from DB store the OTP in DB for verification. But it will take space
Session["OTP"] = OTP;
mpesubmit.Show();
////Session["name"] = txtname.Text;
////Session["Number"] = Number;
////Session["email"] = txtemail.Text;
////Session["plan"] = ddlcontent.SelectedItem.ToString();
////Session["city"] = txtcity.Text;
//////Session["pincode"] = txtpincode.Text;
////string EncIP = HttpUtility.UrlEncode(load.EncryptUrl(OTP));
////Response.Redirect(string.Format("otp.aspx?Id={0}", EncIP));
}
catch (Exception ex)
{
lblMessage.Text = ex.Message.ToString();
}