Now I need to add the ability for the user to set subtotals on 1 or more column and to hide other columns. Is there a sample around where this type of dynamic configuration is done in the code behind.
5 Answers, 1 is accepted
I am sending you a sample project illustrating how you may achieve the desired result. Let me know if you need any further assistance.
Maya
the Telerik team
Generally, if you use a GridViewDataColumn, it will work accordingly to the DataType of the property. So, once you define a numeric property, there should be no reason for you not to able to apply a Sum function on it.
As a whole, did you manage to resolve your issue ?
Maya
the Telerik team
As they say do a good job and you just get more work - is it possible to add group totals from the code behind (just fiddling around and dropped a group and low and behold group totals as well). Your work here is done thank you very much!
RadGridView supports two types of group descriptors - GroupDescriptor and ColumnGroupDescriptor. Since Q3 2010, a ColumnGroupDescriptor is added when grouping by the UI. Generally, it is quite more aware of its corresponding column than the regular GroupDescriptor. You may take a look at our online documentation for a reference.
So, if you have already defined aggregates for a particular column and added a ColumnGroupDescriptor, the function will be directly displayed in the GroupRow. Thus, following the sample project above, you may handle the Click event of the second buttons as follows:
private void RadButton_Click_1(object sender, RoutedEventArgs e) ColumnGroupDescriptor groupDescriptor = new ColumnGroupDescriptor(); groupDescriptor.Column = this.clubsGrid.Columns[0]; this.clubsGrid.GroupDescriptors.Add(groupDescriptor);
}So, once you have added the CountFunction by clicking on the first button, the groups and the corresponding aggregates will be created.
All the best,
Maya
the Telerik team