Yes, The class should be marked with [Serializable] attribute.
For Example:
[Serializable]
class Employee
{
int empId;
Public int EmployeeID
{
get { return empid; }
set {empid = value; }
}
}
//Create an object of Employee class
Employee empObj = new Employee();
empObj.EmployeeID = 1000;
//Store Employee class object in ViewState
ViewState["emp"] = empObj;
//Retrieve Employee class object from ViewState
Employee xyz = (Employee) ViewState["emp"];