0
I give you some code that I found when browsing
//
for postback events
public static void
ShowMessageBox(string _message)
{
Page page = HttpContext.Current.Handler
as Page;
page.RegisterStartupScript("key2",
"<script>alert('" + _message +
"');</script>");
}
//
for async postback events
public static void
ShowMessageBoxForAsync(string _message)
{
Page page = HttpContext.Current.Handler
as Page;
ScriptManager.RegisterClientScriptBlock(page,page.GetType(),
"key2", "alert('" + _message + "');", true);
}
// Then you can call this in, let's
say , button_click event handler like this ( i assume that your class name is
Utilities without any namespace definition) :
protected void myButton_Click(object
sender, EventArgs e)
{
Utilities.ShowMessageBox("you
entered a wrong password");
}
It achives the same goal