Hi all,
I've managed to add a filter on a dropdown column in my grid, which allows me to easily look for the correct data in my list. But the issue here is that I cannot filter the list with the filter option "Contains". It always returns me the "EqualTo" values. I need it to work with Contains.
Here is my code:
<
telerik:RadGrid
ID
=
"GridOffences"
runat
=
"server"
DataSourceID
=
"GETOffence"
RenderMode
=
"Auto"
AutoGenerateColumns
=
"False"
ShowFooter
=
"true"
OnItemDataBound
=
"GridOffences_ItemDataBound"
OnItemCommand
=
"GridOffences_ItemCommand"
OnUpdateCommand
=
"GridOffences_UpdateCommand"
OnInsertCommand
=
"GridOffences_InsertCommand"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"offId"
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add Offence"
AllowSorting
=
"false"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"true"
ShowRefreshButton
=
"false"
ShowExportToCsvButton
=
"false"
ShowExportToExcelButton
=
"false"
ShowExportToPdfButton
=
"false"
ShowExportToWordButton
=
"false"
/>
<
EditFormSettings
>
<
EditColumn
UniqueName
=
"EditColumnColumn"
ButtonType
=
"PushButton"
EditText
=
"Edit"
CancelText
=
"Cancel"
InsertText
=
"Add"
UpdateText
=
"Save"
></
EditColumn
>
</
EditFormSettings
>
<
Columns
>
<
telerik:GridDropDownColumn
DataSourceID
=
"GETOffenceList"
ListTextField
=
"offName"
ListValueField
=
"offListId"
UniqueName
=
"offNameList"
HeaderText
=
"Offence"
DataField
=
"offListId"
AllowAutomaticLoadOnDemand
=
"true"
DropDownControlType
=
"RadComboBox"
AllowVirtualScrolling
=
"true"
ShowMoreResultsBox
=
"true"
ItemsPerRequest
=
"10"
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
EnableModelErrorMessageValidation
=
"true"
>
<
RequiredFieldValidator
ForeColor
=
"Red"
ErrorMessage
=
"This field is required"
></
RequiredFieldValidator
>
<
ModelErrorMessage
BackColor
=
"Red"
/>
</
ColumnValidationSettings
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadCbox_File"
runat
=
"server"
DataSourceID
=
"GETOffenceList"
DataTextField
=
"offName"
DataValueField
=
"offListId"
Filter
=
"Contains"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("offListId").CurrentFilterValue %>'
OnClientSelectedIndexChanged="FileComboIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Select an Offence"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptFiles"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function FileComboIndexChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("offListId", args.get_item().get_value(), "Contains");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridDropDownColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks in advance for your help