2009-08-07 7 views
0

データテーブルを元にしたRadGridがあります。 AllowCustomPagingをtrueに設定しました。Rad Telerik GridGroupByExpressionは、ソートグリッドボタンをクリックするまでグループ化されません。

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

方法RadGridSearchResults_NeedDataSourceの後ろに私のコードのためのコードだけで、次の列を使用してDataTableを設定し、返します。

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)); 

RadGridが、私は次のことを実行し、データ・バインドされたら:

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

radgridは、[式でグループ化]ボタンをクリックすると、have hereのようになります:

代わりに、それは次のようになります。

Hosted by imgur.com

どれ手がかり:

Hosted by imgur.com

は、私だけが 'ソート' ボタンをクリックした直後に見ていますか?私は手動で並べ替えを呼び出すことを試みたが、それは成功しなかった。

答えて

2

グループ式を追加すると、グリッドのRebind()メソッドを呼び出してその状態を更新しますか?これは、コントロールを暗黙的に再バインドしないポストバックイベントハンドラからグループ化を適用する場合に必要です。

ディック

関連する問題