Self-written window pops up:
Page.registerclientscriptblock ("alert""<script>alert (' two times password inconsistent, Please re-enter! ') </script>");
"Here's how to find it online"
During the development of the ASP, it is often necessary to give the user prompt information, such as whether "Operation succeeded", "OK" or "Cancel" operation:
(1) Click the button on the page, pop up a dialog box prompt is "OK" or "Cancel" action, we use the button to add properties to complete:
Example:
public System.Web.UI.WebControls.Button btndelrow;btndelrow.attributes.add ("onclick ""return confirm (' OK to delete? '); "
(2) Click on the link on the page, pop up a dialog box prompt is "OK" or "Cancel" action, in the Page_Load () event, you want to give a confirmation prompt to add the properties of the button:
LINK.ATTRIBUTES.ADD ("onclick""return confirm (' Do you want to perform this operation? '); ");
(3) For a page to complete an action, a popup dialog box prompts whether "Operation succeeded":
Response.Write ("<script>alert (' Delete succeeded! ') </script>"
(4) allow an ASP. NET server control to issue a client script block in the Page:
Public Virtual voidRegisterStartupScript (stringKeystringscript); Example:if(! This. IsStartupScriptRegistered ("Hello")) This. RegisterStartupScript ("Hello","<script>alert (' Hello! ') </script>");
Popup dialog (the other party method):
The OK dialog box pops up:
Response.Write ("<script language=javascript>alert (' Message! ');</script>");
Popup "OK" dialog box, click on the jump page:
Response.Write ("<script language=javascript>alert (' Message! '); Window.navigate ('. /index.aspx ');</script>");
Pop up the OK and Cancel dialog boxes and click OK to do the following:
Method One: In the Page_Load event, write button1.attributes["OnClick"]= "Javascript:return confirm (' Are you sure you want to delete it? '), and then write your execution code in the Button1_onclick event.
Method Two: Write directly in the Button1_onclik event
Response.Write ("<Script Language=javascript>if (Confirm (' are you sure you want to delete it? '){window.navigate ('dodelete.aspx') );} </Script>"); Method two need to jump to another page to perform operations, a little more cumbersome than the method, but how to use to see the specific situation.