This is a migrated thread and some comments may be shown as answers.

Default Filter Error

4 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff Reinhardt
Top achievements
Rank 1
Jeff Reinhardt asked on 20 Jul 2010, 04:02 PM
If I put the following in the ASPX:      <MasterTableView FilterExpression="([Active] = True)">     and put the CurrentFilterFunction="EqualTo" and CurrentFilterValue="True"  on the GridBoundColumn Named Active    The filter is set but does not filter the records.

If I put this in the codebehind on the NeedDataSource Method:

protected void rgManage_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            rgManage.DataSource = GetDataSet();
            if (!Page.IsPostBack)
            {
                rgManage.MasterTableView.FilterExpression = "([Active] = True)";
                GridColumn column = rgManage.MasterTableView.GetColumnSafe("Active");
                column.CurrentFilterFunction = GridKnownFunction.EqualTo;
                column.CurrentFilterValue = "True";
            }
        }

I get the following error on page load:

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 expected


What am I missing here?   Active is a boolean datatype.

4 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 20 Jul 2010, 06:30 PM
Have you tried setting the DataType of that column to boolean? Like so: DataType="System.Boolean".

That way the grid knows it's a boolean.

I hope that helps.
0
Jeff Reinhardt
Top achievements
Rank 1
answered on 20 Jul 2010, 06:49 PM
Yes, this did not work.  Still get the expression error.
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Jul 2010, 09:00 AM
Hello Jeff,

Try to set EnableLinqExpressions property of RadGrid as 'false' and check whether this eliminates the exception.

Hope this helps,
Princy.
0
Jeff Reinhardt
Top achievements
Rank 1
answered on 21 Jul 2010, 01:54 PM
That worked.  A little frustrating to have to know to turn that off for something so simple.   Thank you Princy.
Tags
Grid
Asked by
Jeff Reinhardt
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Jeff Reinhardt
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or