A
Amelyan
What is the common way in ASP.NET C# to pop up a confirmation dialog box?
E.g.
Are you sure you want to delete this item?
Yes No
E.g.
Are you sure you want to delete this item?
Yes No
Brock Allen said:You should never make it to btnDelete_Click if they hit cancel. This works
for me and only calls the server event when they choose "OK":
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
_button.Attributes.Add("onclick", "return confirm('delete?');");
}
protected void _button_Click(object sender, EventArgs e)
{
Response.Write("Click");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server" >
<asp:Button runat="server" ID="_button" Text="Click"
OnClick="_button_Click" />
</form>
</body>
</html>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.