Here's the scenario: As users create complex grouping sets, I want to remove the column they are grouping on from the list of columns. For example, they decide to group on category. Instead of showing category in the list of columns, now I don't need it since the items are grouped by category. They decide to remove the grouping for category, so it needs to be placed back into the grid.
Is this possible with a short amount of code?
Here's the code I'm currently using:
<telerik:RadGrid ID="CurrentCostCentersGrid" runat="server" Skin="Office2007" AllowMultiRowSelection="True"
AllowMultiRowEdit="True" ShowGroupPanel="True" AllowPaging="True" DataSourceID="DataSourceUnits"
GridLines="None" AutoGenerateColumns="False" PageSize="50" ShowFooter="true">
<ClientSettings AllowDragToGroup="true" AllowGroupExpandCollapse="true" AllowColumnsReorder="true"
AllowExpandCollapse="true">
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelected="CostCenterSelected" OnRowDeselected="CostCenterUnselected" />
</ClientSettings>
<GroupPanel Enabled="true" Text="Groups">
</GroupPanel>
<PagerStyle Mode="NextPrevAndNumeric" NextPageText="Next" PrevPageText="Previous" />
<MasterTableView ShowGroupFooter="true" ShowFooter="true" DataSourceID="DataSourceUnits"
DataKeyNames="CostCenterItemID" CommandItemDisplay="None" ClientDataKeyNames="CostCenterItemID">
<CommandItemTemplate>
<asp:Button ID="BulkApproveButton" runat="server" Text="Bulk Approve" />
</CommandItemTemplate>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="False">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridClientSelectColumn>
</telerik:GridClientSelectColumn>
<telerik:GridBoundColumn HeaderText="Fund" DataField="FundID" AllowFiltering="true"
DataType="System.Int32" SortExpression="FundID" ReadOnly="True" UniqueName="Fund" />
<telerik:GridBoundColumn HeaderText="Unit" DataField="UnitID" AllowFiltering="true"
DataType="System.Int32" SortExpression="UnitID" ReadOnly="True" UniqueName="Unit" />
<telerik:GridBoundColumn HeaderText="Line Item" DataField="LineItemID" AllowFiltering="true"
DataType="System.Int32" SortExpression="LineItemID" ReadOnly="True" UniqueName="LineItem" />
<telerik:GridBoundColumn HeaderText="Description" DataField="LineItemName" SortExpression="LineItemName"
UniqueName="Description" ReadOnly="true" Groupable="false" />
<telerik:GridBoundColumn HeaderText="Previous Budget" DataField="PreviousBudget"
AllowFiltering="true" DataType="System.Decimal" SortExpression="PreviousBudget"
UniqueName="PreviousBudget" DataFormatString="{0:C}" ReadOnly="True" Aggregate="Sum"
FooterAggregateFormatString="{0:C}" Groupable="false" />
<telerik:GridBoundColumn HeaderText="Previous Actual" DataField="PreviousActual"
DataType="System.Decimal" SortExpression="PreviousActual" UniqueName="PreviousActual"
DataFormatString="{0:C}" Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}" />
<telerik:GridBoundColumn HeaderText="Current Budget" DataField="CurrentBudget" DataType="System.Decimal"
SortExpression="CurrentBudget" UniqueName="CurrentBudget" DataFormatString="{0:C}"
Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}" />
<telerik:GridBoundColumn HeaderText="Current YTD" DataField="CurrentYTD" DataType="System.Decimal"
SortExpression="CurrentYTD" UniqueName="CurrentYTD" DataFormatString="{0:C}"
Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}" />
<telerik:GridBoundColumn HeaderText="Proposed Budget" DataField="ProposedBudget"
DataType="System.Decimal" SortExpression="ProposedBudget" UniqueName="ProposedBudget"
Groupable="false" Aggregate="Sum" FooterAggregateFormatString="{0:C}" DataFormatString="{0:C}" />
<telerik:GridBoundColumn DataField="Category" EmptyDataText="&nbsp;" HeaderText="Category"
SortExpression="Category" UniqueName="Category">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="StatusName" EmptyDataText="&nbsp;" HeaderText="Status"
SortExpression="StatusName" UniqueName="StatusName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Modify Date" DataField="ModifyDate" DataType="System.DateTime"
SortExpression="ModifyDate" UniqueName="ModifyDate" />
</Columns>
<DetailTables>
<telerik:GridTableView DataSourceID="DataSourceHistory" AutoGenerateColumns="false"
ShowHeader="false" GroupsDefaultExpanded="false" NoDetailRecordsText="No notes currently exist for this item"
Width="85%" CommandItemDisplay="Top">
<CommandItemTemplate>
<telerik:RadToolBar ID="DetailsToolbar" runat="server" Skin="WebBlue" Width="100%"
AutoPostBack="true">
<ExpandAnimation Type="OutQuad" Duration="150" />
<CollapseAnimation Type="InQuad" Duration="150" />
<Items>
<telerik:RadToolBarButton Text="Make Request" CommandName="MakeRequest" ImageUrl="Images/request.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton IsSeparator="true">
</telerik:RadToolBarButton>
<telerik:RadToolBarDropDown Text="Approvals">
<Buttons>
<telerik:RadToolBarButton Text="Approved" CommandName="ManagerApprove" ImageUrl="Images/approve.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Rejected" CommandName="ManagerReject" ImageUrl="Images/reject.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Approve - Lock" CommandName="PortalApprove" ImageUrl="Images/paapprove.gif">
</telerik:RadToolBarButton>
<telerik:RadToolBarButton Text="Reject - Back to Manager" CommandArgument="PortalReject"
ImageUrl="Images/pareject.gif">
</telerik:RadToolBarButton>
</Buttons>
</telerik:RadToolBarDropDown>
</Items>
</telerik:RadToolBar>
</CommandItemTemplate>
<ParentTableRelation>
<telerik:GridRelationFields MasterKeyField="CostCenterItemID" DetailKeyField="ItemID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn>
<ItemTemplate>
<strong>
<%
#Eval("CreateDate","{0:d}") %> <%#Eval("CreateDate","{0:t}") %> - <%#Eval("UserName")%>:</strong>
<%
#Eval("NoteText")%><br />
<strong style="color: Red">Requested Increase:</strong>
<%
#Eval("RequestedBudget", "{0:C}")%>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<PagerStyle Mode="NextPrevAndNumeric" />
<PagerTemplate>
Item Description
</PagerTemplate>
</MasterTableView>
<FilterMenu EnableTheming="True" Skin="Gray">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>