To add a confirm box to ur code, try this.
Button1.Attributes.Add("OnClick", "return confirm('Are you Sure you want to
delete this?');");
you can get the message box dialog result like this.
set the CommandArgument Property to some text and check the text in the
button click event.
If the text matches the user has clicked "OK", else cancel.
Ex:
Button1.CommandArgument = "YES";
private void Button1_Click(object sender, System.EventArgs e)
{
//returns "YES" when OK is clicked in the confirm window.
string str1 = ((Button)sender).CommandArgument;
if (str1 == "YES")
{
//add code to do task
}
else
{
//do someother task
}
}
Anto Rocked!
13 years ago
No comments:
Post a Comment