I am trying to customize the look & feel when exporting a fairly complex RadGrid. I have used several of the common techniques to either hide or swap out columns within the main (Master) table and those are working perfectly. However, whenever I attempt to modify the look of the DetailTable, the changes are totally ignored... specifically:
1. The detail table shows the command row (Add New / Refresh) even though the MasterTable properly hides it (ExportOnlyData is set to True as is HideStructureColumns; these are set at the grid level, could not find any separate settings at the DetailTable level).
2. Setting the column visibility to False in code (during the ItemCommand) is not working for DetailTables, though it is working fine for the columns in the MasterTable. Code below (removed some code, but not related to the column hiding; both columns ARE properly found and visibility set):
| public void RadGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| RadGrid exportingGrid = source as RadGrid; |
| // only respond to the commands which invoke a built-in export |
| switch (e.CommandName) |
| { |
| case RadGrid.ExportToCsvCommandName: |
| case RadGrid.ExportToExcelCommandName: |
| case RadGrid.ExportToPdfCommandName: |
| case RadGrid.ExportToWordCommandName: |
| exportingGrid.MasterTableView.Columns.FindByUniqueName("CommandColDisplay").Visible = false; |
| exportingGrid.MasterTableView.DetailTables[0].Columns.FindByUniqueName("DeptCommandColDisplay").Visible = false; |
| break; |
| } |
Any insight or hints that anyone could provide would be greatly appreciated.
Adam