954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Transfer data between pages

Hi,

I have been trying to transfer some data from one page to another but nothing seems to work. Data is not being passed to the next page. Can anyone tell me a reason why this could happen?

comp_231
Newbie Poster
1 post since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

If you are using the .net framework 2.0 or greater, you may want to look at the PreviousPage property of the Page object.

For example, let's say you have a hidden field in your original page named hfTheHiddenField and want its value when you get the target page. You can do something like this...

Control ctrl;
string theString;
ctrl = PreviousPage.FindControl("hfTheHiddenField");
if(ctrl != null) {
  //cast it and get it's string value.
  theString.Value = ((HiddenField)ctrl).Value.ToString(); 
}


You could also use Server.Transfer or the Request.Response objects to get values from previous pages as well.

M_K_Higa
Junior Poster
102 posts since Sep 2006
Reputation Points: 12
Solved Threads: 2
 

or use a session variable ?

Session("session_name") = DATA


then get it back wherever you wish by using

Session("session_name").value()


then free up memory and

Session.remove("session_name")


(SYNTAX VB.NET)

Fungus1487
Posting Pro in Training
459 posts since Apr 2007
Reputation Points: 66
Solved Threads: 56
 

Can an array of structures be passed?

pchamber
Newbie Poster
1 post since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

Hi,

I have been trying to transfer some data from one page to another but nothing seems to work. Data is not being passed to the next page. Can anyone tell me a reason why this could happen?


HI
u can use querystring,session,hidden field ,cookies...

Sals
Light Poster
33 posts since Jan 2009
Reputation Points: 10
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You