I'm trying to figure out how to implement a filter on a template column that has multiple checkbox values.
Scenario
The data source that I'm using for my grid control is an ObjectDataSource that is returning a list of business account objects. This particular column represents a List<> of cost categories objects (contains a name field and boolean isUsed property) that the business account can be used for. The customer wants all available cost categories displayed as check boxes with the ones associated to the current business account to be checked. They want to be able to filter this column by selecting one cost category names from a drop down and it to filter the rows to only those that have that cost category checked.
The code below is from the current page (I removed industry specific terms for the sake of clarity). The selected cost categories are being correctly checked during the ItemDataBound and the filter template is being displayed correctly. However, when I select a value I'm getting the error message following the code.
Code
Error Message
Can someone point me in the right direction?
Thanks,
Kyle
Scenario
The data source that I'm using for my grid control is an ObjectDataSource that is returning a list of business account objects. This particular column represents a List<> of cost categories objects (contains a name field and boolean isUsed property) that the business account can be used for. The customer wants all available cost categories displayed as check boxes with the ones associated to the current business account to be checked. They want to be able to filter this column by selecting one cost category names from a drop down and it to filter the rows to only those that have that cost category checked.
The code below is from the current page (I removed industry specific terms for the sake of clarity). The selected cost categories are being correctly checked during the ItemDataBound and the filter template is being displayed correctly. However, when I select a value I'm getting the error message following the code.
Code
<telerik:GridTemplateColumn FilterControlAltText="Filter AccountCostCategory column" HeaderText="Cost Category" UniqueName="AccountCostCategory"> <ItemTemplate> <asp:CheckBox ID="chkAccountCostCategory_CC1" runat="server" Text="Cost Category 1" /> <asp:CheckBox ID="chkAccountCostCategory_CC2" runat="server" Text="Cost Category 2" /> <asp:CheckBox ID="chkAccountCostCategory_CC3" runat="server" Text="Cost Category 3" /> <asp:CheckBox ID="chkAccountCostCategory_CC4" runat="server" Text="Cost Category 4" /> </ItemTemplate> <FilterTemplate> <telerik:RadComboBox ID="ddlAccountCostCategoryFilter" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("AccountCostCategory").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="AccountCostCategoryFilterChanged"> <Items> <telerik:RadComboBoxItem Text="All" /> <telerik:RadComboBoxItem Text="Cost Category 1" Value="CC1" /> <telerik:RadComboBoxItem Text="Cost Category 2" Value="CC2" /> <telerik:RadComboBoxItem Text="Cost Category 3" Value="CC3" /> <telerik:RadComboBoxItem Text="Cost Category 4" Value="CC4" /> </Items> </telerik:RadComboBox> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function AccountCostCategoryFilterChanged(sender, args) { var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); tableView.filter("AccountCostCategory", args.get_item().get_value(), Telerik.Web.UI.GridFilterFunction.EqualTo); } </script> </telerik:RadScriptBlock> </FilterTemplate> <ItemStyle Width="120px" BackColor="#FDE9D9" /></telerik:GridTemplateColumn>Error Message
Expression expected Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Telerik.Web.UI.ParseException: Expression expectedSource Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ParseException: Expression expected] Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +184 Telerik.Web.UI.ExpressionParser.ParsePrimary() +17 Telerik.Web.UI.ExpressionParser.ParseUnary() +115 Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +55 Telerik.Web.UI.ExpressionParser.ParseAdditive() +60 Telerik.Web.UI.ExpressionParser.ParseComparison() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +55 Telerik.Web.UI.ExpressionParser.ParseExpression() +28 Telerik.Web.UI.ExpressionParser.ParseArguments() +56 Telerik.Web.UI.ExpressionParser.ParseIif() +94 Telerik.Web.UI.ExpressionParser.ParseIdentifier() +221 Telerik.Web.UI.ExpressionParser.ParsePrimary() +17 Telerik.Web.UI.ExpressionParser.ParseUnary() +115 Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +55 Telerik.Web.UI.ExpressionParser.ParseAdditive() +60 Telerik.Web.UI.ExpressionParser.ParseComparison() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +55 Telerik.Web.UI.ExpressionParser.ParseExpression() +28 Telerik.Web.UI.ExpressionParser.ParseParenExpression() +52 Telerik.Web.UI.ExpressionParser.ParsePrimary() +17 Telerik.Web.UI.ExpressionParser.ParseUnary() +115 Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +55 Telerik.Web.UI.ExpressionParser.ParseAdditive() +60 Telerik.Web.UI.ExpressionParser.ParseComparison() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +55 Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +55 Telerik.Web.UI.ExpressionParser.ParseExpression() +28 Telerik.Web.UI.ExpressionParser.Parse(Type resultType) +31 Telerik.Web.UI.GridDynamicQueryable.Where(IQueryable source, String predicate, Object[] values) +172 Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +2148 Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +855 Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +29 Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +265 Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +225 Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +411 Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +392 Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +858 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +94 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +182 Telerik.Web.UI.GridTableView.PerformSelect() +206 Telerik.Web.UI.GridTableView.DataBind() +432 Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +159 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +52 Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +50 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +52 Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +102 Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +7403 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707Can someone point me in the right direction?
Thanks,
Kyle