DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Transfer data between pages (http://www.daniweb.com/forums/thread82311.html)

comp_231 Jul 1st, 2007 4:58 am
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?

M_K_Higa Jul 2nd, 2007 12:23 pm
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...

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.

Fungus1487 Jul 3rd, 2007 10:11 am
Re: Transfer data between pages
 
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)

pchamber Nov 10th, 2009 4:48 pm
Can an array of structures be passed?

Sals Nov 11th, 2009 7:04 am
Quote:

Originally Posted by comp_231 (Post 397172)
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...


All times are GMT -4. The time now is 12:41 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC