Skip to content

Commit 6706bfd

Browse files
author
Marin Bratanov
committed
docs(grid): get selected items checklist filtering
1 parent 9124c14 commit 6706bfd

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

controls/grid/functionality/filtering/checklist-filtering.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,34 @@ End Sub
598598

599599
As with checklist filtering there will be a ListBox that displays the available values. You need to provide DataSource for the ListBox. You can use any of the data binding approaches described above. When the ListBox is data bound there will be a TextBox displayed above it that can be used to filter the items displayed in the ListBox.
600600

601-
>tip If you want the filters to cascade (contain only values present in the grid data source), you will need to provide an appropriate data source to the `ListBox` in the `FilterCheckListItemsRequested` event. You can get the current grid filter from the `grid.MasterTableView.FilterExpression.ToString()` line so you can use it in your own data source query. Read more on how filter expressions look like in the [Operate with the FilterExpression Manually]({% slug grid/how-to/filtering/operate-with-the-filterexpression-manually %}) article.
601+
>tip If you want the filters to cascade (contain only values present in the grid data source), you will need to provide an appropriate data source to the `ListBox` in the `FilterCheckListItemsRequested` event. You can get the current grid filter from the `grid.MasterTableView.FilterExpression.ToString()` line so you can use it in your own data source query. Read more on how filter expressions look like in the [Operate with the FilterExpression Manually]({%slug grid/how-to/filtering/operate-with-the-filterexpression-manually %}) article.
602602
603+
You can get the list of checked items via the `ListOfFilterValues` property of the column.
603604

605+
````C#
606+
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
607+
{
608+
if (e.CommandName == "HeaderContextMenuFilter")
609+
{
610+
string colName = ((System.Web.UI.Triplet)e.CommandArgument).First;
611+
string[] items = ((RadGrid)sender).MasterTableView.GetColumn(colName).ListOfFilterValues;
612+
foreach (string Str in items) {
613+
Response.Write(Str + "<br />");
614+
}
615+
}
616+
}
617+
````
618+
````VB
619+
Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGrid1.ItemCommand
620+
If e.CommandName = "HeaderContextMenuFilter" Then
621+
Dim colName As String = DirectCast(e.CommandArgument, System.Web.UI.Triplet).First
622+
Dim items As String() = DirectCast(sender, RadGrid).MasterTableView.GetColumn(colName).ListOfFilterValues
623+
For Each Str As String In items
624+
Response.Write(Str & "<br />")
625+
Next
626+
End If
627+
End Sub
628+
````
604629

605630
## See Also
606631

0 commit comments

Comments
 (0)