view state and data binding

S

Sergey Krutous

Hi.
I am developing composite web control which contains a ListBox. I'd like
to minimize the amount of data transfered in view state to the client and
back, so I set to false EnableViewState property of the ListBox and
populated it by DataBind method. But in such scenario ListBox's
SelectedIndex property always returns -1 on postbacks.
Could you please answer is it possible to know what item was selected by
user in ListBox with view state disabled? What method or event should I
handle in the page's (or control's) life cycle?
I thought such properties as what item was selected in a ListBox are not
retrieved from view state. Browser can not change VIEWSTATE hidden variable,
it (VIEWSTATE variable) can even be protected from tampering by setting
EnableViewStateMac property to true. So browser should post back such
properties in some other way. Am I not right?

Best regards.
Sergey Krutous.
 
J

Josh

Without viewstate the control contains nothing after a postback. However if
you use "Request.Form" you should be able to get the value your after.
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top