During the development process of ASP.NET programs, we often need to provide prompt information to the user, such as whether the operation is "successful", "confirm" or "cancel".
(1) Click the button on the page, and a dialog box will pop up to prompt whether it is an "OK" or "Cancel" operation. We add attributes to the button to complete:
Examples are as follows:
public System.Web.UI.WebControls.Button btnDelRow;
btnDelRow.Attributes.Add("onclick", "return confirm('Are you sure you want to delete?');");
(2) After completing an operation on the page, a dialog box will pop up to prompt whether "the operation was successful".
Examples are as follows:
Response.Write("<script>alert('Delete successfully!')</script>");
(3) Allow ASP.NET server control to issue client script blocks in Page:
public virtual void RegisterStartupScript(string key,string script);
An example is as follows:
if(!this.IsStartupScriptRegistered("hello"))
this.RegisterStartupScript("hello","<script>alert('Hello!')</script>");
http://www.cnblogs.com/yourhoneysky/archive/2006/10/23/537407.html