You can use this code on the .cs page to display a message box if you use the update panel
ScriptManager.RegisterStartupScript(this, this.GetType(), "myalert", "alert('Type here your message...')", true);
or
ScriptManager.RegisterStartupScript(this.ControlID, this.GetType(), "myalert", "alert('Type here your message')", true);
or this code to display a message box if you are not using the update panel
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Type here your message')", true);
source share