If your class would be a control, it would have its own ViewState collection
(which would be saved and restored by the page framework).
However, if your class is stand-alone custom class, it either can take the
ViewState collection as a reference in and operate with it, or it can just
return the value(s) to the caller (Page) and let that handle operating with
the ViewState (there are examples of both in this thread).
Only controls (Page and its controls) have ViewState collection (each
control has its own) and therefore accessing it from a custom class needs
certain approach. Sessions you could access from class via
System.Web.HttpContext.Current.Session, but there's not similar way to
access ViewState.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU