Hi,
I'm trying to refresh my grid and groups
C#
I'm trying to refresh my grid and groups
<
telerik:RadGrid
ID
=
"HomeRadGrid"
runat
=
"server"
OnNeedDataSource
=
"HomeRadGrid_NeedDataSource"
EnableEmbeddedSkins
=
"False"
AllowPaging
=
"True"
AllowAutomaticUpdates
=
"false"
AllowAutomaticInserts
=
"false"
AllowAutomaticDeletes
=
"false"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"True"
CellSpacing
=
"0"
Culture
=
"it-IT"
GridLines
=
"None"
OnItemCommand
=
"HomeRadGrid_ItemCommand"
OnGroupsChanging
=
"HomeRadGrid_GroupsChanging"
OnItemDataBound
=
"HomeRadGrid_ItemDataBound"
Skin
=
"MySkin"
ShowGroupPanel
=
"True"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
AutoGenerateColumns
=
"False"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"Id"
>
<
ColumnGroups
>
<
telerik:GridColumnGroup
Name
=
"GeneralInformation"
HeaderText
=
"General Information"
HeaderStyle-HorizontalAlign
=
"Center"
/>
<
telerik:GridColumnGroup
Name
=
"WarningsIcon"
HeaderText
=
"Warnings"
HeaderStyle-HorizontalAlign
=
"Center"
/>
</
ColumnGroups
>
<
CommandItemSettings
RefreshText
=
""
ShowAddNewRecordButton
=
"false"
/>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldAlias
=
"Company"
FieldName
=
"Cdc.CompanyCode"
></
telerik:GridGroupByField
>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"Cdc.CompanyCode"
SortOrder
=
"Descending"
></
telerik:GridGroupByField
>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldAlias
=
"Project"
FieldName
=
"Cdc.Code"
></
telerik:GridGroupByField
>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"Cdc.Code"
></
telerik:GridGroupByField
>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Cdc.CompanyCode"
HeaderText
=
"Company Code"
SortExpression
=
"Cdc.CompanyCode"
UniqueName
=
"Cdc.CompanyCode"
Visible
=
"false"
ColumnGroupName
=
"GeneralInformation"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Cdc.Code"
HeaderText
=
"Project"
SortExpression
=
"Cdc.Code"
UniqueName
=
"Cdc.Code"
Visible
=
"false"
ColumnGroupName
=
"GeneralInformation"
>
</
telerik:GridBoundColumn
>
...
</
Columns
>
<
NestedViewTemplate
>
...
</
NestedViewTemplate
>
</
MasterTableView
>
<
ClientSettings
ReorderColumnsOnClient
=
"True"
AllowDragToGroup
=
"True"
AllowColumnsReorder
=
"True"
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
></
ClientEvents
>
<
Selecting
AllowRowSelect
=
"False"
></
Selecting
>
<
Resizing
AllowRowResize
=
"True"
AllowColumnResize
=
"True"
EnableRealTimeResize
=
"True"
ResizeGridOnColumnResize
=
"False"
></
Resizing
>
</
ClientSettings
>
<
GroupingSettings
ShowUnGroupButton
=
"true"
></
GroupingSettings
>
</
telerik:RadGrid
>
/// <
summary
>
/// Eventi sul grid
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void HomeRadGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
switch (e.CommandName)
{
case "RebindGrid":
//tolgo i filtri
foreach (GridColumn column in HomeRadGrid.MasterTableView.OwnerGrid.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue = string.Empty;
}
HomeRadGrid.MasterTableView.FilterExpression = string.Empty;
//tolgo i gruppi
HomeRadGrid.MasterTableView.GroupByExpressions.Clear();
//Refresh datagrid
HomeRadGrid.Rebind();
break;
}