Edit this page

SaveCustomSettings event

SaveCustomSettings server-side event is raised by the SaveState() method of RadPersistenceManager and can be used to store custom settings to be used when restoring the state.

The example below demonstrates how to store CustomSettings from a hidden field:

<asp:HiddenField ID="wndStateHolder" runat="server" />

<telerik:RadPersistenceManager id="persistenceMngr" runat="server"
    OnSaveCustomSettings="persistenceMngr_SaveCustomSettings" OnLoadCustomSettings="persistenceMngr_LoadCustomSettings">

<telerik:RadButton RenderMode="Lightweight" ID="saveBtn" Text="Save State" runat="server" Width="67px" OnClick="saveBtn_Click">
<telerik:RadButton RenderMode="Lightweight" ID="loadBtn" Text="Load State" runat="server" Width="67px" OnClick="loadBtn_Click">
protected void persistenceMngr_SaveCustomSettings(object sender, Telerik.Web.UI.PersistenceManagerSaveStateEventArgs e)
    e.CustomSettings.Add(new Telerik.Web.UI.ControlSetting() { Name = "pos", Value = wndStateHolder.Value });

protected void saveBtn_Click(object sender, EventArgs e)
    string fileId = Session["CustomPersistenceSettingsKey"].ToString();
    persistenceMngr.StorageProviderKey = fileId;
Protected Sub persistenceMngr_SaveCustomSettings(sender As Object, e As Telerik.Web.UI.PersistenceManagerSaveStateEventArgs)
    e.CustomSettings.Add(New Telerik.Web.UI.ControlSetting() With { _
        .Name = "pos", _
        .Value = wndStateHolder.Value _
End Sub

Protected Sub saveBtn_Click(sender As Object, e As EventArgs)
    Dim fileId As String = Session("CustomPersistenceSettingsKey").ToString()
    persistenceMngr.StorageProviderKey = fileId
End Sub

See Also

Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article