2009/02/13

A simple way to show a popup window

This is what I use:
private static void ShowMessage(Page page, string message)
{
ScriptManager.RegisterClientScriptBlock(page, page.GetType(),
"IncorrectDate", @"<script>alert('" + message + "');</script>", false);
}
Here is how to use:
protected void btnSave_Click(object sender, EventArgs e)
{
//....
ShowMessage(this, "Success!");
}

PS:Your WebForm must support ASP.Net AJAX (your page must have ScriptManager).

No comments:

Post a Comment