I have a web application in which I generate Telerik RadGrids programatically based on some definition. Some of our datasets require custom template columns for which I have created special subclasses of GridTemplateColumn.
Some of the functions I currently override to support single selection filtering:
Everything here works as I expected, I am able to filter the grids by selecting an item in the radcombo box.
My question is, how can I modify this code to allow multiple selections (via the checkbox feature of the radcombo) and have my grid filter to contain the rows with any of the selected values?
The issue would seem to be with the filterItem.FireCommmandEvent. There doesn't seem to be a way to indicate an "IN" filter or ".Contains" in LINQ syntax. Is what I am trying to do not possible? I've see the example solution referenced in other threads, but that involves editing the filter expressions on the grid directly. Is that something I can do from the column itself?
Some of the functions I currently override to support single selection filtering:
protected override void SetupFilterControls(TableCell cell) { base.SetupFilterControls(cell); cell.Controls.RemoveAt(0); var filterList = new RadComboBox(); filterList.Width = FilterControlWidth; filterList.DropDownAutoWidth = RadComboBoxDropDownAutoWidth.Enabled; filterList.AutoPostBack = true; filterList.SelectedIndexChanged += filterList_SelectedIndexChanged; filterList.Items.Add(new RadComboBoxItem("", "")); // COMBO BOX IS POPULATED HERE -- CODE REMOVED cell.Controls.AddAt(0, filterList);}protected override void SetCurrentFilterValueToControl(TableCell cell){ base.SetCurrentFilterValueToControl(cell); if (CurrentFilterValue != "") { (cell.Controls[0] as RadComboBox).SelectedValue = CurrentFilterValue; }}protected override string GetCurrentFilterValueFromControl(TableCell cell){ return (cell.Controls[0] as RadComboBox).SelectedValue;}private void filterList_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e){ GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)sender).NamingContainer; filterItem.FireCommandEvent("Filter", new Pair("EqualTo", UniqueName));}Everything here works as I expected, I am able to filter the grids by selecting an item in the radcombo box.
My question is, how can I modify this code to allow multiple selections (via the checkbox feature of the radcombo) and have my grid filter to contain the rows with any of the selected values?
The issue would seem to be with the filterItem.FireCommmandEvent. There doesn't seem to be a way to indicate an "IN" filter or ".Contains" in LINQ syntax. Is what I am trying to do not possible? I've see the example solution referenced in other threads, but that involves editing the filter expressions on the grid directly. Is that something I can do from the column itself?
