In contrast to values stored in Session Memory, classes that are stored in ViewState need to be marked as Serializable
as the ViewState is serialized to the page in any case (as long as Session Memory is held on the server, the objects are stored in memory without serialization). This explains why it works when objects are stored in Session and doesn't work when stored in ViewState.
Therefore, adding the Serializable
attribute to the ScheduleEntry class and all related classes should solve the issue:
[Serializable]
public class ScheduleEntry
{
// ...
}
For details on ASP.NET ViewState see this link.