Link to home
Start Free TrialLog in
Avatar of digital_soul
digital_soul

asked on

Nested user controls losing Viewstate

Hi Experts

I have a user control (a drop down control) nested within another user control (a gridview) and am using Viewstate to keep track of the gridview SortDirection (ASC or DESC). This works fine, until the selected index is changed in the nested control and then that control needs to read this value from ViewState. At this point however the value is Nothing.

Is there a way of persisting Viewstate across nested user controls?

Thanks

Stewart
Avatar of vusov
vusov
Flag of Ukraine image

Try to use HttpContext.Current.ViewState, instead of simple ViewState
Avatar of digital_soul
digital_soul

ASKER

'VIewState' is not a member of System.Web.HttpContext so Visual Studio tells me.
Would I be better off just storing this value in the Session?
ASKER CERTIFIED SOLUTION
Avatar of vusov
vusov
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial