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

Using GridSettingsPersister with AutoGenerateColumns

9 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Kalsbeek
Top achievements
Rank 1
David Kalsbeek asked on 13 May 2011, 08:06 PM
I've used the GridSettingsPersister class from the demo at http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx successfully with columns that exist at design time. I'm now trying to persist column visibility, grouping and column filters for columns generated by the grid using AutoGenerateColumns="true"

I'm looking for a suggestion regarding how to implement something similar to what is done in the GridSettingsPersister for design-time columns for the run-time columns when using AutoGenerateColumns.

Thank you!

Visual Studio 2010
Target framework: .NET Framework 4
Telerik.Web.UI version 2010.3.1317.40

9 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 19 May 2011, 08:14 AM
Hello David,

The GridSettingsPersister class works for autogenerated columns as well.

Please try it at your end and let me know if any further questions arise.

Regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ankur
Top achievements
Rank 1
answered on 19 Jul 2011, 10:07 PM
I am using the GridSettingsPersister with autogenerated columns successfully. The one thing that does not work is the sequence of the grid columns. If I have moved the Grid columns around and saved the format...subsequently when I load the grid format, the columns do not diaply in the correct order. In code I see that the value for the OrderIndex of a given column is reflecting the new location of the column but when the page renders the index doesn't seem to matter........Appreciate any guidance on this...
0
Mira
Telerik team
answered on 20 Jul 2011, 04:01 PM
Hello Ankur,

We will need some additional time to review the issue at hand.
We will post more information on the matter shortly.

All the best,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ankur
Top achievements
Rank 1
answered on 20 Jul 2011, 10:17 PM
I figured out the issue. Here is the code change that needs to be made in the GridSettingsPersister.cs file to make the changes works for the Autogenerated columns: The change is to add the 2nd forloop (in italic) in the function LoadColumnSettings() so the Autogenerated column settings are extracted and set on the grid columns. 
Can you have the development owner look into this and publish a newer copy of the GridSettingsPersister class.

Thanks
Ankur

protected virtual void LoadColumnSettings()
   {
       if (Settings.AutoGeneratedColumnSettings.Count > 0)
       {
           Grid.ColumnCreated += new GridColumnCreatedEventHandler(Grid_ColumnCreated);
       }
 
       foreach (ColumnSettings colSetting in Settings.ColumnSettings)
       {
           GridColumn column = Grid.MasterTableView.GetColumnSafe(colSetting.UniqueName);
 
           if (column != null)
           {
               SetColumnSettings(ref column, colSetting);
           }
       }
 
       foreach (ColumnSettings colSetting in Settings.AutoGeneratedColumnSettings)
       {
           GridColumn column = Grid.MasterTableView.GetColumnSafe(colSetting.UniqueName);
 
           if (column != null)
           {
               SetColumnSettings(ref column, colSetting);
           }
       }
   }


0
Mira
Telerik team
answered on 21 Jul 2011, 07:37 AM
Hello Ankur,

I am glad to hear that the issue is resolved.
As a reward for posting it in our forums, I am giving you 1000 Telerik points.

Regards,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ankur
Top achievements
Rank 1
answered on 21 Jul 2011, 03:53 PM
What/How are the points used?
0
Sebastian
Telerik team
answered on 21 Jul 2011, 05:06 PM
Hello Ankur,

Get the requested information from here.

Best,
Sebastian
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Elena
Top achievements
Rank 1
answered on 03 Oct 2013, 07:30 PM
Thank you Ankur,

Your fix helped me with the same problem where autogenerated columns would not restore saved order.
And I am surprised that after more than 2 years, Telerik still did not fix their demo.

Elena.
0
Daniel
Telerik team
answered on 08 Oct 2013, 08:25 AM
Hello Elena,

The GridSettingsPersister is a separate class (not a built-in funcitonality) which is used for demo purposes only. That said, may I suggest that you try our Persistence Framework instead of the settings persister class?

Regards,
Daniel
Telerik
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 the blog feed now.
Tags
Grid
Asked by
David Kalsbeek
Top achievements
Rank 1
Answers by
Mira
Telerik team
Ankur
Top achievements
Rank 1
Sebastian
Telerik team
Elena
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or