Dear All,
I have webform with textfields & with submit button.
My requirement is after clicking submit button it should show as follows
If fields are empty it should show alertbox with certain message &
if fields contains data the if should show confirm box with yes & cancel
If ther user select yes it will redirect to another page or If the user select cancel the operation will cancel & the cursor will focus to first textbox.
How to do this?
Thanks
Loading


SenthilkumarRank #387 · 6.5K reputationPosted Mar 29, 2012, 6:51 AM EDT
SIVARank #2,303 · 613 reputationPosted Mar 29, 2012, 7:15 AM EDT
The code is given below for that.
if ((txtUserName.Text == "") && (txtPassword.Text == ""))
{
System.Windows.Forms.MessageBox.Show("Fields should not empty?.", "AlertMessage", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk, System.Windows.Forms.MessageBoxDefaultButton.Button1);
}
else{
if (System.Windows.Forms.MessageBox.Show("do you want to continue?.", "Confirmation Message", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Asterisk, System.Windows.Forms.MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.OK)
{
Response.Redirect("Test.aspx");
}
elseResponse.Redirect("Error.aspx");
}
}
Thanks