Simplest Confirmation dialog box

Certifiedkiller2000
Posted by Certifiedkiller2000 under C# category on | Points: 40 | Views : 5213
often we delete items and we want a dialog box to pop, a simple way is

private void button1_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure??", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MessageBox.Show("deleted");
}
}

Comments or Responses

Posted by: Hiren009 on: 7/27/2011 Level:Starter | Status: [Member] | Points: 10
For web application

<asp:button id="btnDelete" runat="Server" text="Delete" onclientclick="return confirm('Are u Sure you want to delete?')" />


Posted by: T.saravanan on: 7/27/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
@Certifiedkiller2000 kindly post your code inside the code tag.

@Hiren009 i think Certifiedkiller2000 post a code for windows application but your code for web application any how both are useful to users.
Posted by: Certifiedkiller2000 on: 7/28/2011 Level:Starter | Status: [Member] | Points: 10
oh ok dint notice about it m new so haappned :)

@ Hiren thankx
@ T saravanan thankx

Login to post response