show message box in asp.net(c#)
-
thanks for ur help i write this [confirm("message")] insted of [confirm('message') means " insted of ' and showed error. now thats right thanks. one question: i should write delete command after this syntax means after btnDelete.attributes.add("onclick",javascriptreturn confirm('message')"; ??????? ur mean is if i click ok the recorde be delete and if i click cancel record dont be delete????????
-
thanks for ur help i write this [confirm("message")] insted of [confirm('message') means " insted of ' and showed error. now thats right thanks. one question: i should write delete command after this syntax means after btnDelete.attributes.add("onclick",javascriptreturn confirm('message')"; ??????? ur mean is if i click ok the recorde be delete and if i click cancel record dont be delete????????
Both works ' and ", you can use either. Javascript is tricky, it might be another error. Here's the sample code showing how to use it,
function closeWindow() { if (confirm('Are you sure you want to cancel ')) { alert("yes clicked"); } else { alert("no clicked"); } }
Regards, MaulikCE -
thanks for ur help i write this [confirm("message")] insted of [confirm('message') means " insted of ' and showed error. now thats right thanks. one question: i should write delete command after this syntax means after btnDelete.attributes.add("onclick",javascriptreturn confirm('message')"; ??????? ur mean is if i click ok the recorde be delete and if i click cancel record dont be delete????????
Yes. If you click Ok, the page will post to the server and call the button's event. Clicking cancel will avoid posting to the server. You can simply write: button.Attributes.Add("onclick","return confirm('Delete?');"); daniero