Passing ArrayList object from one page to other

P

pargat.singh

Hi Everyone:


I am using ArrayList to store my objects. Currently i am using
session to store this arraylist and when i open showModalDialog [second
page] i reterive this value from session and assign to GridView like
ArrayList list = (ArrayList)Session["values"];

I no longer can use the session. Can someone please tell me how can i
take this object from page to page.

Thanks in advance.

Pargat
 
L

Laurent Bugnion [MVP]

Hi,

Hi Everyone:


I am using ArrayList to store my objects. Currently i am using
session to store this arraylist and when i open showModalDialog [second
page] i reterive this value from session and assign to GridView like
ArrayList list = (ArrayList)Session["values"];

I no longer can use the session. Can someone please tell me how can i
take this object from page to page.

Thanks in advance.

Pargat

You can use static variables, but with care: Static variables are shared
throughout the whole web application, so you must implement some kind of
session management yourself. If you cannot access Session.SessionID
either, it's going to be tricky.

If you can use the SessionID, you could use a Dictionary<string,
ArrayList> to store and retrieve the values.

Also, you must not forget to clean the static variable when the Session
ends, because the framework won't do that for you. If you forget, you'll
have a memory leak. To clean up, use the global.asax (you may have to
add it to your application yourself, it's the "Global Application Class"
in the "Add new item" dialog), and then implement the Session_End
method. Check on Google for examples.

HTH,
Laurent
 
T

TiSch

Hi Everyone:


I am using ArrayList to store my objects. Currently i am using
session to store this arraylist and when i open showModalDialog [second
page] i reterive this value from session and assign to GridView like
ArrayList list = (ArrayList)Session["values"];

I no longer can use the session. Can someone please tell me how can i
take this object from page to page.

Thanks in advance.

Pargat

Hi,
it depends on what you're saving in the Arraylist. For example when its
a number of IDs you could transfer them per URL-params. I would use
Shared (Static) objects only when every Session needs access to it.

Regards,
Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top