Asp.net form Operation Summary

Source: Internet
Author: User

1. open a new window
This is simple: Response. Write ("<script language = 'javascript '> window. Open ('url'); </SCRIPT> ");
2. Adjust the size and position of the window
Response. Write ("<SCRIPT> window. resizeTo (500,400); </SCRIPT> ");
Response. Write ("<SCRIPT> window. moveTo (300,200); </SCRIPT> ");
3. Close the window
// Close the current window and prompt the user to close it. Yes: close. No: exit.
Response. Write ("<script language = 'javascript '> window. Close (); </SCRIPT> ");
// Close the window with delay (below Code Indicates that the service is disabled in 2 seconds. No confirmation is required)
Response. Write ("<script language = 'javascript '> setTimeout ('self. Close ()', 2000); </SCRIPT> ");

4. Delay Time
This is not much different from the above. I use the case that, after the user operation is complete, the prompt n seconds are given, the page turns to "and so on, you only need to remove the double self. Close ().
Response. Write ("<script language = 'javascript '> setTimeout ('', 2000); </SCRIPT> ");

5. A prompt or warning window is displayed.
Response. Write ("<script language = 'javascript '> alert ('added successfully, the page will automatically jump in 2 seconds'); </SCRIPT> ");
6. Refresh other pages
There are still a lot of situations in this use, such as updating and modifying data on page B, and maintaining the latest data on page A to the customer, this is to refresh a after B is completed:
Response. Write ("<script language = 'javascript '> window. opener. Location. href ='./default. aspx '</SCRIPT> ");

7. page Jump
Sometimes page Jump is performed when a prompt is required. response. Redirect ("url") cannot be used ");
For example, after the customer completes the operation, click the button to submit. A prompt box is displayed (Use 3 and 4 above ).
Response. Redirect ("url ");
The page will not be prompted, that is, if 3 and 4 do not work, they will directly turn.
If you are using the following procedure:
1). response. Write ("<script language = 'javascript '> alert ('added successfully, the page will jump automatically after 2 seconds'); </SCRIPT> ");
2). response. Write ("<script language = 'javascript '> setTimeout ('', 2000); </SCRIPT> ");
3) page orientation:
Response. Write ("<meta http-equiv = 'refresh'/> ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.