Reputation: 19543
We have a Telerik Grid (i.e. enhanced version of ASP.Net vanilla grid). On some postbacks we perform major changes to the grid and we don't want load the viewstate for the grid control for that one page load, but we want viewstate to be load to future loads. And in all cases we want to save the viewstate in case the user uses the same data source each time.
It basically goes like this:
Upvotes: 0
Views: 487
Reputation: 19543
You can derive from the grid control in question and then override the LoadViewState method to not load viewstate when you don't want to.
public class MyGrid : BaseGrid
{
public bool IsNew { get; set; }
public override void LoadViewState(object viewState)
{
if (!this.IsNew)
{
base.LoadViewState(viewState);
}
}
}
Upvotes: 1
Reputation: 51
Set EnableViewState = False for the control you don't want to save ViewState information on. Here is a great article on View State: http://msdn.microsoft.com/en-us/library/ms972976.aspx
Upvotes: 0