The built-in GridDropDownColumn is filtered by its ListValueField when the default filtering feature of the control is used. RadGrid does not include any support for filtering by ListTextField instead.
This limitation is because the filtering mechanism relies on the DataField of the filtered column and for GridDropDownColumn this property specifies the mapping field in the drop-down source. (For more information about the properties of GridDropDownColumn, see Customize/Configure GridDropDownColumn).If you want to filter by ListTextField, your current options are:
use a hidden GridBoundColumn (with Display = false). Add an ItemCommand event handler that catches filter commands from the dropdown column and substitutes a filter command from the GridBoundColumn instead:
ProtectedSub RadGrid1_ItemCommand(ByVal source AsObject,ByVal e As GridCommandEventArgs)Handles RadGrid1.ItemCommand
If e.CommandName = RadGrid.FilterCommandName ThenDim command As Pair =CType(e.CommandArgument, Pair)If command.Second.ToString ="CategoryddColumn"Then
e.Canceled =TrueDim filter As GridFilteringItem =CType(e.Item, GridFilteringItem)CType(filter("CategoryName").Controls(0), TextBox).Text=CType(filter("CategoryddColumn").Controls(0), TextBox).Text
command.Second ="CategoryName"
filter.FireCommandEvent("Filter",New Pair(command.First,"CategoryName"))EndIfEndIfEndSubProtectedSub RadGrid1_ItemDataBound(ByVal sender AsObject,ByVal e As GridItemEventArgs)Handles RadGrid1.ItemDataBound
IfTypeOf e.Item Is GridFilteringItem ThenDim item As GridFilteringItem =TryCast(e.Item, GridFilteringItem)TryCast(item("CategoryddColumn").Controls(0), TextBox).Text=TryCast(item("CategoryName").Controls(0), TextBox).TextEndIfEndSub
Use GridTemplateColumn instead of GridDropDownColumn. You can add a DropDownList in its EditItemTemplate to simulate the GridDropDownColumn.
As RadGrid can only be filtered by fields in its DataSource, these work arounds are only valid when the ListTextField of the GridDropDownColumn is a field from the control's assigned data source.