Hi,
I am trying to implement 3 buttons to filter a templated column in a nested grid.
So i have my buttons. I can find the column. I had the filter. I rebind .. but No filter is apply .
With in my code behind:
I must have miss Something, If you have any idea.
Regards,
I am trying to implement 3 buttons to filter a templated column in a nested grid.
So i have my buttons. I can find the column. I had the filter. I rebind .. but No filter is apply .
<
telerik:GridTableView
runat
=
"server"
DataSourceID
=
"LDS"
Name
=
"PRD"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"1,2,3"
ShowHeader
=
"false"
HierarchyDefaultExpanded
=
"true"
CommandItemDisplay
=
"Top"
>
<
ParentTableRelation
> [...] </
ParentTableRelation
>
<
CommandItemTemplate
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"ClearFilter"
CommandName
=
"ClearFilter"
OnClick
=
"ClearFilter"
>
<
Icon
PrimaryIconCssClass
=
"rbCancel"
/>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton2"
runat
=
"server"
Text
=
"++++++++++++++"
CommandName
=
"Exp"
OnClick
=
"CustomFilter"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton3"
runat
=
"server"
Text
=
"---------------"
CommandName
=
"No-Exp"
OnClick
=
"CustomFilter2"
>
</
telerik:RadButton
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"totaldone"
HeaderText
=
"totaldone"
UniqueName
=
"SuperFilter"
>
[...]
</
telerik:GridTemplateColumn
>
</
Columns
>
With in my code behind:
protected
void
CustomFilter(
object
sender, EventArgs e)
{
dude(RG_BL.MasterTableView);
}
protected
void
dude(GridTableView gridTableView)
{
GridItem[] nestedViewItems = gridTableView.GetItems(GridItemType.NestedView);
foreach
(GridNestedViewItem nestedViewItem
in
nestedViewItems)
{
// Let's find the grid
foreach
(GridTableView nestedView
in
nestedViewItem.NestedTableViews)
{
this
.Label1.Text += nestedView.Name +
"("
+ nestedView.Items.Count +
")"
+
" | "
;
if
(nestedView.Name ==
"PRD"
)
{
// Got the Grid
nestedView.FilterExpression =
string
.Empty;
foreach
(GridColumn column
in
nestedView.Columns)
{
// The Column ?
if
(column
is
GridTemplateColumn && column.UniqueName ==
"SuperFilter"
)
{
// Here.
GridTemplateColumn myColumn = column
as
GridTemplateColumn;
myColumn.CurrentFilterFunction = GridKnownFunction.GreaterThan;
myColumn.CurrentFilterValue =
"0"
;
}
}
nestedView.Rebind();
}
if
(nestedView.HasDetailTables)
{ dude(nestedView); }
}
}
}
I must have miss Something, If you have any idea.
Regards,
Pierre