Viewstate versus performance

  • Thread starter Thread starter Bigal
  • Start date Start date
B

Bigal

If I want to create a ListBox filled by a database query, it is not
recommended to enable the viewstate of the form,
because it does not make sense to reconstruct the whole and costs
performance.
But what if I want to react on the onChange event, I do have to set
autoRepost to true to get my selectedItem.
It seems I need the viewstate to retrieve my selection.

What is the best practice to do this:
- fill list by database query
- react on change event at the client site or with minimum overhead on
server
 
You don't necessarily need ViewState to do this. Assuming
when binding the ListBox you are using a column from the
DB that identifies a record, to populate the Value
property of the list items you could use Request.Form
("ListBoxName") to retrieve the selected item(s).
 
Back
Top