New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Saving the grid ViewState in Session

There are cases in which you may want to reduce the grid ViewState though you have enabled multiple server/client side features of the control (thus bypassing the EnableViewState = false choice with its limitations). In such situation to work properly with the NeedDataSource advanced data-binding or population through data source control, Telerik RadGrid's ViewState has to be turned on.

Still, a possible solution for ViewState reduction is to relocate it in a Session variable. The code below illustrates how to apply this technique under ASP.NET 3.x or 4.x:ASP.NET 3.x/4.x:

C#
PageStatePersister _pers;
protected override PageStatePersister PageStatePersister
{
    get
    {
        if (_pers == null)
        {
            _pers = new SessionPageStatePersister(this);
        }
        return _pers;
    }
}

Further information on this subject can be found in the MSDN articles linked below:

https://msdn.microsoft.com/en-us/library/aa479403.aspx

https://msdn.microsoft.com/en-us/library/system.web.ui.pagestatepersister(VS.80).aspx

See Also

In this article
See Also
Not finding the help you need?
Contact Support