Gets a "Expression Expected" error on filtering van RadGrid in codebehind

4 posts, 1 answers
  1. Anders
    Anders avatar
    30 posts
    Member since:
    Jul 2013

    Posted 10 Nov 2014 Link to this post

    In this simple example (found here in the forum) for setting the filtering in code behind I get a "Expression Expected"  error.

    I have already set the EnableLinqExpression="false" in the grid.

    public enum MyEnum
    public partial class Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
        protected void RadButton1_Click(object sender, EventArgs e)
            if (RadGrid1.MasterTableView.FilterExpression == "")
                RadGrid1.MasterTableView.FilterExpression = "([Value] = '" + MyEnum.Value1 + "')";
                RadGrid1.MasterTableView.FilterExpression = "";
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
            DataTable table = new DataTable();
            for (int i = 1; i < 6; i++)
                table.Rows.Add("Key" + i.ToString(), "Value" + i.ToString());
            RadGrid1.DataSource = table;

    <head runat="server">
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        <script type="text/javascript">
            //Put your JavaScript code here.
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <h2>Test Grid filtering</h2>
            <telerik:RadButton ID="RadButton1" runat="server" onclick="RadButton1_Click"
        <telerik:RadGrid ID="RadGrid1" runat="server" EnableLinqExpression="false" AllowFilteringByColumn="true"
            onneeddatasource="RadGrid1_NeedDataSource" Width="500px">

    What are I doeing vrong?

    Anders Pedersen
  2. Anders
    Anders avatar
    30 posts
    Member since:
    Jul 2013

    Posted 10 Nov 2014 in reply to Anders Link to this post

    Sorry for the double post - I thought the first was not accepted.
  3. DevCraft R3 2016 release webinar banner
  4. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    1744 posts

    Posted 13 Nov 2014 Link to this post

    Hello Anders,

    The issue that you are experiencing is due to the fact that you have minor mistake within your RadGrid settings, which could be easily missed. The correct name of the property that you need to set to false is "EnableLinqExpressions" and not "EnableLinqExpression". Once you add "s" at the end of your property, everything is working correctly and the filter is applied as expected.

    Best Regards,
    Konstantin Dikov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  5. Anders
    Anders avatar
    30 posts
    Member since:
    Jul 2013

    Posted 21 Nov 2014 in reply to Konstantin Dikov Link to this post

    Tanks alot.

Back to Top