How could I access the ViewState of the current page using HttpContext
I have a ViewStateUtil class that I'd need to implement:
public static T GetViewState<T>(ViewStateKey viewStateKey)
{
// how to implement it?! HttpContext.Current...?
}
private static T GetViewState<T>(string name)
{
return (T) ((BasePage)HttpContext.Current.CurrentHandler).PageViewState[name];
}
I added a new PageViewState property and let all my pages inherit from my BasePage to expose ViewState then being able to get or set it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With