Passing ArrayList object from one page to other

  • Thread starter Thread starter pargat.singh
  • Start date Start date
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
 
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
 
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
 
Back
Top