private RegisterClientScriptBlock ( string key, string script ) : void | ||
key | string | |
script | string | |
return | void |
string script = "alert('Hello world!');"; this.Page.RegisterClientScriptBlock("myScript", script, true);
string script = ""; this.Page.RegisterClientScriptBlock("myScript", script);
string script = "if (confirm('Are you sure you want to delete this item?')) {return true;} else {return false;}"; this.Page.RegisterClientScriptBlock("confirmScript", script, true);This code registers a client script block that displays a confirmation dialog before the user deletes an item. If the user clicks "OK", the function returns true. Otherwise, it returns false. The third parameter specifies that the script should be added to the page at the bottom of the tag. The RegisterClientScriptBlock method is part of the System.Web assembly.
private RegisterClientScriptBlock ( string key, string script ) : void | ||
key | string | |
script | string | |
return | void |