944,099 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 9589
  • ASP.NET RSS
Jul 1st, 2007
0

Transfer data between pages

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
comp_231 is offline Offline
1 posts
since Jul 2007
Jul 2nd, 2007
0

Re: Transfer data between pages

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...

c# Syntax (Toggle Plain Text)
  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.
Reputation Points: 12
Solved Threads: 2
Junior Poster
M_K_Higa is offline Offline
102 posts
since Sep 2006
Jul 3rd, 2007
0

Re: Transfer data between pages

or use a session variable ?

ASP.NET Syntax (Toggle Plain Text)
  1. Session("session_name") = DATA

then get it back wherever you wish by using

ASP.NET Syntax (Toggle Plain Text)
  1. Session("session_name").value()

then free up memory and

ASP.NET Syntax (Toggle Plain Text)
  1. Session.remove("session_name")

(SYNTAX VB.NET)
Reputation Points: 66
Solved Threads: 56
Posting Pro in Training
Fungus1487 is offline Offline
459 posts
since Apr 2007
Nov 10th, 2009
0
Re: Transfer data between pages
Can an array of structures be passed?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pchamber is offline Offline
1 posts
since Nov 2009
Nov 11th, 2009
0
Re: Transfer data between pages
Click to Expand / Collapse  Quote originally posted by comp_231 ...
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...
Reputation Points: 10
Solved Threads: 6
Light Poster
Sals is offline Offline
33 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Checkbox list
Next Thread in ASP.NET Forum Timeline: save .aspx page as .html file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC