Windows Message Box usage in Web application

We can use Windows Message Box in Asp.Net Web Application and Web Site.

Steps:

1. Add Reference of System.Windows.Form

2. Add Name Space as System.Windows.Form

3.Use the MessageBox class inside your class directly.

(E.g)


Protected Void Button1_Click(Object Sender,EventArgs e)
{
try
{
//Message Box

MessageBox.Show("Hi This is from Button1 Click");

//Confirm Message Box

if(MessageBox.Show("Hi To confirm","Confirm",MessageBoxButtons.YesNo)==DialogResult.Yes)
{
MessageBox.Show("Hi, You Pressed Yes");
}
else
{
MessageBox.Show("Hi, You Pressed No");
}
}
Catch(Exception exMessage)
{
Response.Write(exMessage.Message);
}
}
---


Enjoy Programming.....!
Karthick.C


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: