I have a list of type List<JobSeeker>
. I want to store it in ViewState. How this can be done?
private List<JobSeeker> JobSeekersList { get; set; }
I have a list of type List<JobSeeker>
. I want to store it in ViewState. How this can be done?
private List<JobSeeker> JobSeekersList { get; set; }
Basically you only need to use the
get
, then on get you either get the posted data from view state, or set it for the first time on the view state. This is the more robust code to avoid all the checks on each call (is view state set, exist etc), and direct saved and use the view state object.Alternative to avoid the
is
and the
JobSeeker
class must be[Serializable]
asand you simple call it normally as an object and will never be null. Also will be return the saved on viewstate values after the post back