This is a migrated thread and some comments may be shown as answers.

Saving grid settings

4 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 27 Jul 2012, 09:59 AM
Hello,

I am trying to save the custom settings of a RadGrid (Sort expressions, Filter expressions, Column settings).
To achieve this, I am using the GridSettingsPersister (as described in http://www.telerik.com/help/aspnet-ajax/grid-saving-settings-on-per-user-basis.html) and a StreamWriter to save the data in a .txt-file while the application is being closed (Page_Unload). I would like to load the settings using a StreamReader and the GridSettingsPersister the next time I start the application (Page_Load), but there seems to be an error with that (System.InvalidCastException). Visual Studio is telling me that [A]GridSettingsCollection can't be transformed into [B]GridSettingsCollection.

Is that error expected or is there a workaround for this situation?

Thanks in advance,
Robin

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Aug 2012, 09:55 AM
Hi Robin,

Actually we have not encounter such issue before and therefore I am not quite sure what is causing this appearance. Can you make sure that you have used the GridSettingsPersister as demonstrated in this online demo? If this not help I will ask you to provide a sample runnable project which will help us to reproduce this behavior. We could debug it locally and help you out with a suitable solution.

All the best,
Pavlina
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
Robin
Top achievements
Rank 1
answered on 02 Aug 2012, 08:41 AM
Hello Pavlina,

Thank you for your response, but it seems like I have already been able to solve that problem by myself.
Somehow though the GridSettingsPersister doesn't seem to save the width of the columns, although it does seem to save everything else just fine. Is there anything I would need do look out for strictly - if I load the settings from a .txt-file on the Page_load and save them on the Page_Unload - to save the width of the single columns (I am using a RadGrid with 100% Width and UseStaticHeaders set to "true")?

Thanks in advance,
Robin
0
Robin
Top achievements
Rank 1
answered on 07 Aug 2012, 08:16 AM
Hello Pavlina,

I would like to add another question to my previous Reply: I am using the Header Context Menu of the Rad Grid, and it seems like the Settings Persister doesn't save the "hidden" state of each Column. Is that supposed to be that way, or am I missing out on something?

Thanks in advance,
Robin
0
Pavlina
Telerik team
answered on 07 Aug 2012, 09:20 AM
Hi,

At this point to be able to provide a proper solution for your case it will be best if you open a formal support ticket and send us the problematic project. Thus we will be able to debug it locally and advice you further.

All the best,
Pavlina
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.
Tags
Grid
Asked by
Robin
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Robin
Top achievements
Rank 1
Share this question
or