473,388 Members | 1,552 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Passing Array between pages

Hi,

How to pass the array or arraylist(dataset or any other object in fact) from
one page to another.
I am using the one page to display 10 records and another page to display
and modify the selected record. I want to pass the values of selected record
from one page to another. Can someone help me to do that?

Thanks in advance.
K_
Nov 19 '05 #1
4 4364
In a session variable.

Eliyahu

"Paraki" <Pa****@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
Hi,

How to pass the array or arraylist(dataset or any other object in fact) from one page to another.
I am using the one page to display 10 records and another page to display
and modify the selected record. I want to pass the values of selected record from one page to another. Can someone help me to do that?

Thanks in advance.
K_

Nov 19 '05 #2
On the page where you get your data, do this:

ArrayList myData = new ArrayList();
myData.Add("hello world");

Session["MyData"] = myData; //Add the data to session.

On subsequent pages when you need the data, do this:

ArrayList myDataRetrieved = (ArrayList)Session["MyData"];
Nov 19 '05 #3
Thanks a lot. That helped me a lot.
Can the custom objects be stored in session in similar way? I mean instead
of arraylist if I have a class called "Animals" and dog is the object, can I
pass this object between pages?

K_
"Andy Luksic" wrote:
On the page where you get your data, do this:

ArrayList myData = new ArrayList();
myData.Add("hello world");

Session["MyData"] = myData; //Add the data to session.

On subsequent pages when you need the data, do this:

ArrayList myDataRetrieved = (ArrayList)Session["MyData"];

Nov 19 '05 #4
Sure, you can store any object in session state, with one caveat: If you use
out of process session state, your object must be serializable. If you're
just using the standard in process session state, you don't have to worry
about it.

"Paraki" wrote:
Thanks a lot. That helped me a lot.
Can the custom objects be stored in session in similar way? I mean instead
of arraylist if I have a class called "Animals" and dog is the object, can I
pass this object between pages?

K_
"Andy Luksic" wrote:
On the page where you get your data, do this:

ArrayList myData = new ArrayList();
myData.Add("hello world");

Session["MyData"] = myData; //Add the data to session.

On subsequent pages when you need the data, do this:

ArrayList myDataRetrieved = (ArrayList)Session["MyData"];

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
5
by: Raju V.K | last post by:
I am developing a web site which requires a set og unique values be transferred between pages and server many times. There fore i decided to put the values in an array so that only one reference to...
5
by: Andy Fish | last post by:
Hi, I have a HTML page with javascript in it which pops up another HTML page. I can pass simple variables fairly freely between the two pages. I can pass objects between them two, and I have...
4
by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL:...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
1
by: williamroy | last post by:
Hello, I've got a form that runs over 5 pages. I need the last page submit button to post all of the answers at one time from the previous 5 pages (to another server). I'd like to see the last...
5
by: aelred | last post by:
I have a web page where a member can open up a chat window (child window) with another member. - From there the member can also navigate to other web pages. - From other pages in the site, they...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.