Easy way to showing messageboxes in asp.net using c#

Create a class and add these two methods to it :

// 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");
}

How can I show alert messages if a changed happend on the form before moving to the next form to save.
The idea is to show an alert to the user if has made changes to the first screen of a multi-step form and he moves to the second screen without saving it.

How can I show the prompt to the user only when there is a change on the screen in case of edit.

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.