views:

217

answers:

2

Good Morning,

I have created an ASP.NET 3.5 webform that allows users to search a parts list. The two textbox controls supply the input paramenters to the stored procedure. The gridview returns the search results from the stored procedure.

I have enhanced the gridview to include a template field with a textbox for Quantity, as well as a button control in the gridview footer to be used to Add the Parts (with quantity) to a quote request.

A user might search for a nail and a hammer, select a nail and input 25 quantity and select a hammer with 1 quantity. These items and quantities must be retained for use in the quote process.

Question: Given my scenario, do you advise storing the gridview quantities, part name etc. in a session? If not, what is the best way to save these items for use later in the quote process?

Thanks, Sid

+1  A: 

While the gridview is being displayed, i.e. you are rendering it, I would keep the details on that page. When you step off that page to continue the ordering process then I would probably store them in the session, or keep them on the page in a hidden area.

The reason for this is that the Session is loaded on every page request so you don't want to keep information in the Session for the shortest amount of time necessary.

To further complicate your application if the user uses the browser back and forward buttons then what would be the expected result. Consider, they have added the nails, and then the hammer, then they click the back button to prior to them adding the ammer, and then add a screwdriver. What is the order? nails, hammer and screwdriver? or nails and screwdriver? Thus keeping the data on the page if possible is good because if the user steps back, so does the order state. Becareful though, you don't want to add so much to the page that the ViewState expands too much, so watch for that and turn it off if you don't need it.

David McEwing
I thought about adding another page control that gets populated when user clicks Add to Quote button. This does 2 things: 1) Persists the business logic of only allowing 20 parts (line items). 2) Reminds user of items they've already selected. If I did this, as a visible control, what type of control is advisable?
SidC
+1  A: 

I see no issue with using session as this doesn't sound like a heavy duty app. The only other thing you could do is use a database and store it as a temp row in the database. You'll have to get rid of it when you don't need it.

The only other thing you could do is cache it.

JonH