PDA

Click to See Complete Forum and Search --> : Best way to parse objects?


MrNorth
Jun 16th, 2004, 03:41 AM
I have a 3 tier application which is about cars and dealership.

On the ShowAllCars.aspx I am creating a Cars object, and it's constructor loads it with car objects from the data tier.

I then bind the collection to the datagrid

When the user then clicks on one of the cars in teh datagrid, I want to redirect to another page and show car details.

I could parse the car key as parameter to the new page and then create a car object there

BUT

Since I have already created the car object (when the cars collection was instanciated) isn't it much smarter to parse just that car object to the next page, all the information is already there, loaded and ready.

Since I have only some knowledge about asp.net I don't know whihc the best way is to parse that one object? I know I have viewstate, cache and session to work with, but which is best?
Session seems like a bad idea, and viewstate doesn't apply here.
I thought about caching the entire cars object when it is loaded on the first page. and the when I enter the view details, I first check to see if the object is stored in the cache.

But I have one problem.. how to access the correct car. I guess I have to write a GetCarByKey method which returns the proper car object to me from the array.. or is there another better way?

kind regards
Henrik