Hi,
redirect is the same as coming to completely refreshed page (e.g starting
from 0). ViewState is persisted only on postbacks. eg when you make a POST
request to the page with posted data (also having the viewstate hidden
field's data). Redirect does not post, so there's not any viewstate involved
and controls cannot keep their state. If you cannot make it as a postback
instead of redirecting, you could use session variables to store the index
and restore on after redirecting.
See: Understanding ASP.NET ViewState
http://msdn.microsoft.com/library/de.../viewstate.asp
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"JN" <jn*****@rogers.com> wrote in message
news:eb**************@TK2MSFTNGP14.phx.gbl...
When the button click event is raised, the value of the selectedindex of
the listbox is stored in the viewstate.
After refreshing the page using response.redirect, I want the listbox
selectedindex to be the value in the viewstate but value is always 0
instead.
Why is that?
Thanks.
JN