Transfer data between pages

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jul 2007
Posts: 1
Reputation: comp_231 is an unknown quantity at this point 
Solved Threads: 0
comp_231 comp_231 is offline Offline
Newbie Poster

Transfer data between pages

 
0
  #1
Jul 1st, 2007
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?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 100
Reputation: M_K_Higa is an unknown quantity at this point 
Solved Threads: 2
M_K_Higa's Avatar
M_K_Higa M_K_Higa is offline Offline
Junior Poster

Re: Transfer data between pages

 
0
  #2
Jul 2nd, 2007
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...

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

You could also use Server.Transfer or the Request.Response objects to get values from previous pages as well.
-Mike
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: Transfer data between pages

 
0
  #3
Jul 3rd, 2007
or use a session variable ?

  1. Session("session_name") = DATA

then get it back wherever you wish by using

  1. Session("session_name").value()

then free up memory and

  1. Session.remove("session_name")

(SYNTAX VB.NET)
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC