New to Telerik UI for ASP.NET Core? Download free 30-day trial

Persist state

Loading Demo...
  • Edit in Theme Builder
  • persist_state.cshtml
  • Persist_StateController.cs
  • EmployeeDirectoryController.cs
  • EmployeeDirectoryModel.cs

Also available for:



A common scenario is to save the user's preferences and settings when interacting with your application. These preferences should be restored once the user logs back in at any point in the future.

The Telerik for ASP.NET Core TreeList enables you to save the applied user preferences by using the getOptions method and then restore them using the setOptions method. These methods allow you to serialize TreeList's current state when needed and recover it later on.

In this particular example, we use the localStorage of the browser to save and load the TreeList widget's settings.

Further information on the setOptions and getOptions methods is available in the TreeList Client-side API section.

Support & Learning Resources