How to have a confirmation button in my codes below? (Yes - cancel)
ClientScript.RegisterStartupScript(typeof(Page), "key", "<script>alert('There is an exiting Insurance code. Are you sure do you want to Edit it?');</script>");
I tried this one but its not working..
ClientScript.RegisterS开发者_Go百科tartupScript(typeof(Page), "key", "if(!confirm('There is an existing insurance code . Do you want to edit?'))return false;");
thanks!
Use javascript confirm dialog instead of alert.
function confirmation() {
var answer = confirm("There is an exiting Insurance code.
Are you sure do you want to Edit it?")
if (answer){
alert("You clicked OK.");
}
else{
alert("You clicked Cancel.");
}
}
Use the confirm
function.
It's probably worth noting that usability principles often frown upon this
Edit Probably something along the lines of
if (confirm('There is an exiting Insurance code.' + "\n" + "Are you sure you want to Edit it?"))
ClientScript.RegisterStartupScript(typeof(Page));
精彩评论