title: Selfmade MessageBox.Show() in ASP.NET
body: <p>I want to rebuild the "look &amp; feel" of MessageBox.Show() of WinForms applications.</p>
  
  <p><strong>With "look &amp; feel" I mean to JUST CALL the MessageBox.Show() command with the logic of my already implemented ShowMessage method.</strong></p>
  
  <p>My current codebehind:</p>
  
  <pre><code>public partial class Testpage : System.Web.UI.Page
  {
      public enum MessageBoxIcon { Information, Error, Warning }
  
      protected void Page_Load(object sender, EventArgs e)
      {
          ShowMessage("Testmessage", MessageBoxIcon.Error, ex);
      }
  
      private void ShowMessage(string title, string message, MessageBoxIcon type, Exception ex)
      {
          if (type == MessageBoxIcon.Information)
          {
              pnlMsgBox.CssClass = "MessageBoxInformation";
              imgMsgBox.ImageUrl = "Resources/img/icon/MessageBoxIcon.Information.png";
          }
  
          else if (type == MessageBoxIcon.Warning)
          {
              pnlMsgBox.CssClass = "MessageBoxWarning";
              imgMsgBox.ImageUrl = "Resources/img/icon/MessageBoxIcon.Warning.png";
          }
  
          else if (type == MessageBoxIcon.Error)
          {
              pnlMsgBox.CssClass = "MessageBoxError";
              imgMsgBox.ImageUrl = "Resources/img/icon/MessageBoxIcon.Error.png";
          }
  
          else
              throw new NotImplementedException();
  
          lblMsgBox.Text = "&lt;span style=\"font-size: large;\"&gt;" + title + "&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;" + message;
  
          #if (DEBUG)
          if (ex != null)
              lblMsgBox.Text += "&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Debug information:&lt;/b&gt; " + ex.Message;
          #endif
  
          pnlMsgBox.Visible = true;
  
          updPnl.Update();
      }
  }
  </code></pre>
  
  <p>I'd like to call something like this:</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          MessageBox.Show("Testmessage", MessageBoxIcon.Error, ex);
      }
  </code></pre>
  
  <p>But</p>
  
  <pre><code>public static class MessageBox : Testpage
  {
      public static void Show(string message)
      {
          // do stuff with the page controls.
      }
  }
  </code></pre>
  
  <p>doesn't work as you all know, because Testpage isn't static.</p>
  
  <p>Does anybody have some suggestions for me?</p>