By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

Passing ArrayList object from one page to other

P: n/a
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

Jan 15 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

pa**********@gmail.com wrote:
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,
ArrayListto 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
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 15 '07 #2

P: n/a

pa**********@gmail.com schrieb:
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

Jan 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.