Hi,
I have been using the save/load layout settings for a while. I noticed that the Display Index is now being saved in the Q1 2010 which is great!
However, I have just ran into a problem where my value converter wasn't being called when the the save/load was enabled.
I then also noticed that the DataFormatString wasn't being saved, and so wasn't being loaded either, meaning my date columns weren't formatted.
I have modified the LoadState code slightly, so that it doesn't clear the GridView Columns and re-add them, but just sets the values from the saved ColumnSetting collection.
This is working fine for my needs currently, but it would be good to have the DataFormatString and the value converter binding saved and working correctly.
(Please let me know if what I have done isn't a good solution as I wasn't sure the reasoning behind clearing all the built GridView Columns and readding them. )
Thanks,
A Marshall
I have been using the save/load layout settings for a while. I noticed that the Display Index is now being saved in the Q1 2010 which is great!
However, I have just ran into a problem where my value converter wasn't being called when the the save/load was enabled.
I then also noticed that the DataFormatString wasn't being saved, and so wasn't being loaded either, meaning my date columns weren't formatted.
I have modified the LoadState code slightly, so that it doesn't clear the GridView Columns and re-add them, but just sets the values from the saved ColumnSetting collection.
public virtual void LoadState() |
{ |
try |
{ |
Settings.Reload(); |
} |
catch |
{ |
Settings.Reset(); |
} |
if (this.grid != null) |
{ |
grid.FrozenColumnCount = Settings.FrozenColumnCount; |
if (Settings.ColumnSettings.Count > 0) |
{ |
foreach (GridViewDataColumn column in grid.Columns) |
{ |
ColumnSetting setting = Settings.ColumnSettings.FirstOrDefault<ColumnSetting>(x => x.UniqueName == column.UniqueName); |
if (setting != null) |
{ |
column.IsVisible = setting.IsVisible; |
column.DisplayIndex = setting.DisplayIndex; |
if (setting.Width != null) |
{ |
column.Width = new GridViewLength(setting.Width.Value); |
} |
} |
} |
} |
... |
} |
This is working fine for my needs currently, but it would be good to have the DataFormatString and the value converter binding saved and working correctly.
(Please let me know if what I have done isn't a good solution as I wasn't sure the reasoning behind clearing all the built GridView Columns and readding them. )
Thanks,
A Marshall