How to pass values from one page to another in asp.net?

 Posted by Susanthampy on 6/23/2011 | Category: ASP.NET Interview questions | Views: 8197 | Points: 40
Answer:

In ASP.NET there are several methods to pass values between pages. For passing and storing values asp.net using State management techniques. There are different types of state management techniques are there. They are
Here I am Explaining 2 techniques,
1. Querystring,
2. Session,

QueryString
In QueryString , attaching the values with the URL of the page,
For Example,
Response.Redirect("OrganizationDetailsAM.aspx?ApplicationDetailsID=" + applicationDetailsID + "&ApplicationType=" + applicationType, false);

For retieving this value in the next page,
Request.QueryString["ApplicationDetailsID"]


Session

A session is defined as the period of time that a unique user interacts with a Web application.
For Example,

Session["Name"]=value;
For retrieving,

variable=session["Name"];


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response