I have a grid bound to an objectdatasource (base class datatable) and am trying to fliter using a dropdownlist for a boolean variable (took forever to figure our that the filter required a capitalized "True").
Here is my filter template:
the selectedIndexChanged:
itemcreated (it is the only filter I use):
I check on NeedDataSource and the filteringexpression is correct ([Pediatric] = True), but it wasn't filtering.
So I created a test checkbox column:
and while this set the exact same filteringexpression, it worked. Combining my template and setting the GridCheckBoxColumn visible property to false also works, so no idea what is going on. Also, the sorting does work if any of this filtering is occuring (even if off)
Thanks,
Reuven
Here is my filter template:
| <FilterTemplate> |
| Show: |
| <asp:DropDownList runat="server" ID="ddlFilter" OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged" |
| AutoPostBack="true"> |
| <asp:ListItem Value="None" Text="All Cases" /> |
| <asp:ListItem Value="Pediatric" Text="Pediatric only" /> |
| </asp:DropDownList> |
| </FilterTemplate> |
the selectedIndexChanged:
| Protected Sub FilterCombo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) |
| Dim filterExpression As String |
| If CType(sender, DropDownList).SelectedValue = "Pediatric" Then |
| filterExpression = "([Pediatric] = True)" |
| Else |
| filterExpression = String.Empty |
| End If |
| RadGridCases.MasterTableView.FilterExpression = filterExpression |
| RadGridCases.MasterTableView.Rebind() |
| End Sub |
| Protected Sub RadGridCases_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridCases.ItemCreated |
| If TypeOf (e.Item) Is Telerik.Web.UI.GridFilteringItem Then |
| If Not RadGridCases.MasterTableView.FilterExpression Is String.Empty Then |
| CType(e.Item.FindControl("ddlFilter"), DropDownList).SelectedValue = "Pediatric" |
| End If |
| End If |
| End Sub |
I check on NeedDataSource and the filteringexpression is correct ([Pediatric] = True), but it wasn't filtering.
So I created a test checkbox column:
| <telerik:GridCheckBoxColumn DataField="Pediatric" AllowFiltering="true" /> |
Thanks,
Reuven