asp.net the difference between the value and jump between pages _ practical skills

Source: Internet
Author: User
Jump to B.aspx in a.aspx
The difference between Server.Transfer ("b.aspx") and Response.Redirect ("b.aspx")
If you are jumping to b.aspx in a.aspx by Server.Transfer (), on the B.aspx page, you can find the value in the control that is saved in the A.aspx page, if it is Response.Redirect (), You cannot get the value of the control in the A.aspx page.
If you are passing Server.Transfer ("b.aspx"), you can tell the following ways to get values that remain in a.aspx such as Label,hiddenfield
Copy Code code as follows:

HiddenField Hforderid = new HiddenField ();
HiddenField Hfpaymoney = new HiddenField ();
if (page.previouspage!= null)
{
Try
{
//
//Find master page,
MasterPage MasterPage = (MasterPage) Page.previouspage.controls[0];
//
//Find container
ContentPlaceHolder ContentPlaceHolder = (ContentPlaceHolder) Masterpage.findcontrol (" ContentPlaceHolder3 ");
System.Web.UI.UserControl UserControl = (System.Web.UI.UserControl) contentplaceholder.findcontrol ("MyOrder1") ;
//
//Find the corresponding data transfer HiddenField
Hforderid = (HiddenField) usercontrol.findcontrol ("Hforderid");
Hfpaymoney = (HiddenField) usercontrol.findcontrol ("Hfpaymoney");
//
//Get the Incoming order number
String strorderid = Hforderid.value;
String Strpaymoney = Hfpaymoney.value;
}
}

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.