Technical Features published across web pages: 1. controls can be transmitted to the displayed new web page. 2. Only the original web page is directed to the same web application. Program Target webpage 3. allows you to read values and public attributes from the source webpage. 4. Do not use the information of the target webpage to update the browser information, following the previous step in the browser will cause unexpected behavior usage: In crosspagesource. set the postbackurl attribute of the button in aspx to crosspagetarget. aspx in crosspagetarget. add the following program to the page_load event of aspx: protected void page_load (Object sender, eventargs e ){ Textbox txtusername = (textbox) previouspage. findcontrol ("txtusername "); Txtmst. TEXT = "your input name is:" + txtusername. text;} the cross-page publishing technology must be attached to the postbackurl attribute of the button, and only the three types of Button, linkbutton, and imagebutton are supported. Public attribute values are obtained from the source webpage, 1. In crosspagetarget. set <% @ previouspagetype virtualpath = "~ /Crosspagesource. aspx "%> used: txtmsg. Text = previouspage. GetUserName; 2. Use <% @ reference virtualpath = "~ /Crosspagesource. aspx "%> when reading: @ reference has a strong type feature. The advantage is that you can directly access protected void page_load (Object sender, eventargs e ){ // Convert previouspage to the same strong type as the source webpage Referencesource sourcepage = (referencesource) previouspage; Txtmsg. Text = "your input name is:" + sourcepage. GetUserName + "," + sourcepage. City; } Ispostback judgment Cross-page publishing must use the iscrosspageepostback attribute to determine whether the following program exists: Protected void page_load (Object sender, eventargs e ){ // Convert previouspage to the same strong type as the source webpage If (previouspage! = NULL) // this check is required. You must use the cross-page publishing mechanism to ensure the integrity of the program. { If (previouspage. iscrosspagepostback) { Iscrosspagesource sourcepage = (iscrosspagesource) previouspage; Txtmsg. Text = "your input name is:" + sourcepage. GetUserName + "," + sourcepage. City; } }} Principles of cross-page publishing: 1. When the source webpage is published to the target webpage across webpages, the post-backurl attribute of the button is used to specify the target webpage. After you press the button, the target webpage is directed to the target webpage. 2. After the target webpage stores the viewstate of the source webpage in another copy, the State stored in the viewstate of the source webpage will be discarded, 3. When the previouspage object is used on the target webpage, the system automatically initializes the same page type as the source webpage (previewpage), and in the page_complete stage of the target page Restore the previously stored viewstate to previouspage. 4. previouspage indicates a new entity that is the same as the source webpage, and injects the viewstate that was originally reserved. Therefore, this is why the object can be accessed Reason for Source Page If viewstate is very large, it indicates that the storage and restoration costs are very high. Therefore, cross-page publishing and querystring parameter passing are required.
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.