Telerik blogs
One of the most frequently asked questions is “how to persist the settings of control N?” This is why we decided to address your needs by creating a standalone RadControls Persistence Framework. Wait no more, it is already here and is ready to help you save your UI-configurable settings in the store of your choice.
You may ask "Why should I use this framework?" Because it is very fast, does not rely on reflection, supports custom settings, and is specially tailored to work with our AJAX controls. By default, we offer an XML serialization provider and AppData store provider, but thanks to the great extendability and the flexible design, you will be able to create your own custom store and serialization providers with ease.

Getting started

What you need to get started is to set the StorageProviderKey string and then add (either declaratively or programmatically) the corresponding settings to the control. When this is done, you only have to call the SaveState and LoadState methods in the appropriate place in your code. You can see our online example here: Persistence Framework Overview

<telerik:RadPersistenceManager ID="RadPersistenceManager1" runat="server"
    StorageProviderKey="Settings">
    <PersistenceSettings>
        <telerik:PersistenceSetting ControlID="RadGrid1" />
    </PersistenceSettings>
</telerik:RadPersistenceManager>

Custom settings

Another interesting matter is how to save custom settings. This is an easy task, thanks to the OnSaveCustomSettings/OnLoadCustomSettings events. They are raised when the PersistenceManager saves/loads the state. You have to handle the corresponding event and then pass/get your settings as a KeyValuePair<string, ControlSetting>. You can test this functionality online: Persistence Framework Custom Settings

Design-time support

You already know that setting up the Persistence Framework through the code is a breeze, but if you are a design-time fan you can also take advantage of the configuration panel offered for the PersistenceManager (and the proxy, of course).

PersistenceManager Design-Time Configuration Panel

What's new?

Starting from the RadControls for ASP.NET AJAX Q1 SP1 release the Persistence Framework is no longer with “beta” status. I encourage you to download and try the aforementioned release which not only adds support for new controls (Filter, ToolBar, RibbonBar, etc) but also improves the persistence for the existing ones (Grid for example).
Should you need an example or more information, I’d suggest that you have a look at our demos and documentation. Also, if you have any additional questions or suggestions, you can post them in the comments below. You know that we highly appreciate your feedback so don’t hesitate to share your thoughts with us.


About the Author

Daniel Peichev

is Software Developer at one of Telerik's ASP.NET AJAX teams, where he primarily works on exporting functionality for RadGrid and RadTreeList. Daniel is interested in ASP.NET, Javascript, CSS and the cutting edge Microsoft technologies and products.

Related Posts

Comments

Comments are disabled in preview mode.