How to show a message box in an ASP.NET page?

前端 未结 8 633
青春惊慌失措
青春惊慌失措 2020-12-20 01:34

As I was a Windows programmer it was so easy to show a message box on a form.

But on an ASP.NET page I don\'t know how can I show it?

Actually I have some co

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 01:42

    i have a solution for you, may be it help you, for using that same message box or conformation dialog of c# in Asp.Net, first you should add namespace,

    Using System.Windows.Forms;

    then, where you want to call a message box or conformation dialog, you can just call it as simple as in c#, like:

    DialogResult dialogResult = MessageBox.Show("Are you shure?", "Some Title", MessageBoxButtons.YesNo);

        if (dialogResult == DialogResult.Yes)
        {
            Response.Redirect("Page.aspx");
        }
        else if (dialogResult == DialogResult.No)
        {
            MessageBox.Show("You Select Nothing to do... :(");
      }
    

    I think, I explained properly, sorry for any mistake....

提交回复
热议问题