if (Session["Customer_ID"] == null)
{
if (MessageBox.Show("Do you want to login or countinue without login?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
// user clicked yes redirects to login page
}
else
{
// user clicked no do something
}
}
it shows the "The name 'MessageBox' does not exist in the current context" error i have used System.Windows.Forms
The best and simple way to deal with Yes/No confirmation in Javascript world is use confirm box. Refer this tutorial: http://www.w3schools.com/js/js_popup.asp
Here goes the code for it:
The above approach will Prompt user with OK & CANCEL buton only but if you really want to change the button to YES/NO then you have to write your own Alert box. Refer this tutorial for further details: http://www.codeproject.com/Articles/25640/ASP-NET-Csharp-MessageBox