Viewstate versus performance

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
 
G

Gary McCormack

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top