C# .NET 3.5
I have a frequent need to be able to hide some columns in a grid on display, but have them available on export and hide others on export. Thus far I've had no luck in being able to do all three. The show on export of the columns we hide for display is the piece that's not working for me.
I have in the ItemCreated command the hide columns code
and in the ItemCommand for the export piece the code to show the prev hidden columns then hide addional ones from the export
The hide on display works. The hide of the additional columns on export works. But I can't seem to show on export the columns we hid for display purposes. It seems the ItemCreated event is exercised multiple times (as far as I can tell 1x before and 2x after) when invoking the ItemCommand function.
Any suggestions on how to show on export the columns we want hidden on display?
Thanks!
Telerik.Web.UI, Version=2008.3.1125.35
I have a frequent need to be able to hide some columns in a grid on display, but have them available on export and hide others on export. Thus far I've had no luck in being able to do all three. The show on export of the columns we hide for display is the piece that's not working for me.
I have in the ItemCreated command the hide columns code
// hide columns |
string myColumnsToHide = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix", "HideOnDisplayResults_RadGrid1"); |
foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns) |
{ |
if (myColumnsToHide.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|")) |
{ |
myColumn.Display = false; |
} |
} |
and in the ItemCommand for the export piece the code to show the prev hidden columns then hide addional ones from the export
// show columns we hid for display |
string myColumnsToShow = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix", "HideOnDisplayResults_RadGrid1"); |
foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns) |
{ |
if (myColumnsToShow.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|")) |
{ |
myColumn.Display = true; |
} |
} |
// then hide any coulmns we don't want on export |
string myColumnsToHide = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix", "HideOnExport_RadGrid1"); |
foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns) |
{ |
if (myColumnsToHide.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|")) |
{ |
myColumn.Display = false; |
} |
} |
The hide on display works. The hide of the additional columns on export works. But I can't seem to show on export the columns we hid for display purposes. It seems the ItemCreated event is exercised multiple times (as far as I can tell 1x before and 2x after) when invoking the ItemCommand function.
Any suggestions on how to show on export the columns we want hidden on display?
Thanks!