2009/03/12

A simple way to show a popup window (2)

Last time I show how to popup a window if your website supports AJAX, and this time I am going to show you how to do the same thing if your website doesn't support AJAX.
public static void ShowMessage(Page page, string text)
{
  Literal oLiteral = new Literal();
  oLiteral.Text = "<script>alert('" + text + "')</script>";
  page.Controls.Add(oLiteral);
}
Here is how to use:
protected void btnSave_Click(object sender, EventArgs e)
{
ShowMessage(this, "Success!");
}

No comments:

Post a Comment