Tips for ASP. NET development

Source: Internet
Author: User

(1) page refresh (parent page, its own page)
Window. Location. href = Window. Location. href (refresh the page after an operation is completed)
Opener. location. href = opener. location. href (after a sub-page operation is completed, refresh the parent page and the data displayed is the data after the sub-Page Operation) window. opener. location. reload (this method is the same as the above method. It is used to refresh the parent page. The difference is that a confirmation dialog box is displayed when this method is used, prompting you to refresh the page again)
(2) Open the page
Window. Open
Window. Location
Similarities: both open pages
Difference: window. open () is to open another website page on a website, is to open a new window, and window. location () is a page that can only be opened for the website. The method of opening is to replace the current page with the page to be opened, and the window. open () can also add some other attributes for the newly opened page, such:
<Script language = "JavaScript">
<! --
Window. open ('page.html ', 'name', 'height = 100, width = 400, Top = 0, Left = 0, toolbar = No, menubar = No, scrollbars = No, resizable = No, location = n o, status = no') // write a line
-->
</SCRIPT>
(3) Use of the defer attribute
You don't need to explain it.

 

 Clientscript. registerstartupscript (page. GetType (),  "  Message  "  ,  "  <Script language = 'javascript 'defer> alert (' the commodity's nominal value is  "     +  Decparvalue. tostring (  "  F3  "  )  +    "  The price you set is too high! '); </SCRIPT>  "  ); 

 

 

Execution result:

 

  Clientscript. registerclientscriptblock (GetType (),  ""  ,  "  <SCRIPT type = \  "  Text /  Javascript \  "  > Alert ('the commodity's nominal value is  "     +  Decparvalue. tostring (  "  F3  "  )  +     "  Cannot exceed this price! '); </SCRIPT>  " ) 

Execution result:

 

(4) differences between response. Redirect and server. Transfer (the copy from a page is completely written)
Execution Process:
1. browser ASP file request-> server execution-> response. Redirect statement-> the server sends the address following response. Redirect to the client browser-> the browser requests a new address.
2. browser ASP file request-> server execution-> server. Transfer statements-> server redirection to new files
Switch object:
1. response. Redirect can switch to any existing webpage.
2. server. Transfer can only switch to a webpage in the same directory or subdirectory.
Data Confidentiality:
1. After response. Redirect, The address will change to the page address after the jump.
2. The address remains unchanged after server. Transfer, hiding the address of the new web page and the parameter values attached to the address. Data Confidentiality.
Transmitted data volume (parameters attached to the URL ):
1. The data that response. Redirect can transmit is limited to 2 kb.
2. When the transmitted data exceeds 2 kb, you must use server. Transfer. Execution Process:
1. browser ASP file request-> server execution-> response. Redirect statement-> the server sends the address following response. Redirect to the client browser-> the browser requests a new address.
2. browser ASP file request-> server execution-> server. Transfer statements-> server redirection to new files
Switch object:
1. response. Redirect can switch to any existing webpage.
2. server. Transfer can only switch to a webpage in the same directory or subdirectory.
Data Confidentiality:
1. After response. Redirect, The address will change to the page address after the jump.
2. The address remains unchanged after server. Transfer, hiding the address of the new web page and the parameter values attached to the address. Data Confidentiality.
Transmitted data volume (parameters attached to the URL ):
1. The data that response. Redirect can transmit is limited to 2 kb.
2. When the transmitted data exceeds 2 kb, you must use server. Transfer.

 

For more information, see! 3q!

Related Article

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.