Custom Range Grouping

1 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 09 Dec 2013 Link to this post


    RadControls version Q3 2012
    .NET version 4.0
    Visual Studio version 2012
    programming language C#, VB
    browser support

    all browsers supported by RadControls


    This project demonstrates how to create custom range grouping with RadGrid when using Advanced Data-Binding through NeedDataSource event. Since the grouping functionality can work only with data fields, in order to achieve custom grouping, a new data field should be added to the data source with values assigned by some custom logic.

    In this particular project, once the DataTable is retrieved from the database, a new column that will hold the grouping values is added to the DataTable. Then, all records in the DataTable are traversed and depending on some condition, a value is assigned to the new column.

    Knowing that RadGrid groups items with matching values for given data field, should help to understand the idea behind this approach.

    When implementing custom range grouping with the approach shown in the attached project, after including "CustomGrouping", "RangeGroup" and "RangeItem" classes in the project, applying the custom grouping should by as easy as calling the CustomGrouping.AddRangeGroupingColumn() method with correct arguments and adding the new column in the "GroupByFields" and "SelectFields" within the "GroupByExpressions".

    The same principal could be used for creating grouping by any custom logic. 
Back to Top