John Reynolds
Top achievements
Rank 1
John Reynolds
asked on 15 Mar 2013, 03:28 AM
We've been using the GridSettingsPersister provided in the help here.
What must be done to save the settings per user or per machine in a similar fashion with the new persistence framework? Regards, John
3 Answers, 1 is accepted
0
Hi John,
Find attached a sample application which demonstrates possible approach for achieving the required functionality.
I hope this helps.
Greetings,
Maria Ilieva
the Telerik team
Find attached a sample application which demonstrates possible approach for achieving the required functionality.
I hope this helps.
Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 14 Apr 2013, 08:12 PM
Hello,
FYI, in your example there isn't used the Expires property, that's why a cookie persists only during session. That means, when user closes browser and start app again, the cookie is lost.
If you want to have cookie persisted, just add line marked bold:
Best regards
Vasssek
FYI, in your example there isn't used the Expires property, that's why a cookie persists only during session. That means, when user closes browser and start app again, the cookie is lost.
If you want to have cookie persisted, just add line marked bold:
public void SaveStateToStorage(string key, string serializedState)
{
HttpCookie cookie = new HttpCookie(StorageKey);
cookie.Expires = DateTime.Now.AddYears(1);
string settingsData = CompressString(serializedState);
if (settingsData.Length > MaxCookieSize)
{
throw new ArgumentOutOfRangeException("Current settings exceed 4k in compressed form! Operation canceled!");
}
cookie.Value = settingsData;
HttpContext.Current.Response.Cookies.Add(cookie);
}
Best regards
Vasssek
0
Hi Vaclav,
Thank you for pointing this. I'm sure it will be of a big help for the other users trying to implement similar scenarios.
Regards,
Maria Ilieva
the Telerik team
Thank you for pointing this. I'm sure it will be of a big help for the other users trying to implement similar scenarios.
Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.