This is a migrated thread and some comments may be shown as answers.

Error with Grid GroupByExpression

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt Dufrasne
Top achievements
Rank 1
Matt Dufrasne asked on 08 Aug 2009, 07:25 PM
I have a RadGrid with a datatable as it's source.
I have AllowCustomPaging set to true.

    <telerik:RadGrid runat="server" ID="RadGridSearchResults" 
    PageSize="50" AllowPaging="true" AllowCustomPaging="true" 
    OnNeedDataSource="RadGridSearchResults_NeedDataSource" Skin="Default"
    <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
    </telerik:RadGrid> 


The code for my code behind method RadGridSearchResults_NeedDataSource just fills and returns a datatable with the following columns:

    dataTableSearchResults.Columns.Add("recipeId"typeof(string)); 
    dataTableSearchResults.Columns.Add("ingredientsIds"typeof(string)); 
    dataTableSearchResults.Columns.Add("country"typeof(string)); 
    dataTableSearchResults.Columns.Add("author"typeof(string)); 
    dataTableSearchResults.Columns.Add("style"typeof(string)); 
    dataTableSearchResults.Columns.Add("friendly"typeof(string)); 
    dataTableSearchResults.Columns.Add("name"typeof(string)); 


Once the RadGrid is databound, I run the following:

    var expression = GridGroupByExpression.Parse( 
    "recipeId [Recipe], count(recipeId) ingredientsIds [Ingredients]
    Group By recipeId"); 
    this.RadGridSearchResults.MasterTableView.GroupByExpressions.Add(expression); 
    this.RadGridSearchResults.GroupingEnabled = true

I would expect my radgrid to then look like the one they have here once you click on the 'Group by expression' button:

Instead, it looks like this:

After Load

Only looking right after I click the 'sort' button:

After Clicking Sort

Any clue? I even tried invoking sort manually but that was not successful.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Aug 2009, 07:31 AM
Hi Matt,

I suggest you review the following example, that demonstrates the approach for custom paging, grouping and filtering. Please examine it and see if this is the expected behavior and what is the difference in your case.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Matt Dufrasne
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or