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

Missing operand after 'NotEqualTo' operator.

3 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 29 Oct 2011, 10:23 PM
In the code below, I get the error: Missing operand after 'NotEqualTo' operator. 

  if (!Page.IsPostBack)
            {
                grdGSRComp.MasterTableView.FilterExpression = "([Variance] NotEqualTo \'0\') ";
                GridColumn column = grdGSRComp.MasterTableView.GetColumnSafe("Variance");
                column.CurrentFilterFunction = GridKnownFunction.NotEqualTo;
                column.CurrentFilterValue = "0";
                grdGSRComp.MasterTableView.Rebind();
            }

This code runs in page_load.

tried different variations and none worked. Any ideas?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Oct 2011, 05:27 AM
Hello Ken,

I tried the same scenario in PreRender event which worked as expected.

C#:
protected void RadGrid1_PreRender(object sender, System.EventArgs e)
{
    if (!Page.IsPostBack)
    {
        RadGrid1.MasterTableView.FilterExpression = "([Variance] NotEqualTo \'%0%\')";
        GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("Variance");
        column.CurrentFilterFunction = GridKnownFunction.Contains;
        column.CurrentFilterValue = "0";
        RadGrid1.MasterTableView.Rebind();
    }
}

Thanks,
Shinu.
0
Ken
Top achievements
Rank 1
answered on 31 Oct 2011, 02:31 PM
Thanks for your reply Shinu, however that does not work either.

All I'm trying to do is set a default filter for my grid and have it be applied automatically when the grid is loaded.

Does datasource-order assignment matter? I have my Ds in Page_Load, I tried it in prerender but that still doesn't work.

If this doesn't work in telerik then I'll just have to add a parameter and do this at the DB level.

Thanks.
0
Ken
Top achievements
Rank 1
answered on 31 Oct 2011, 03:42 PM
I fixed it.

Instead of code behind, I did this in the ASPX markup and the filter expression I used is: FilterExpression="([Variance] <> 0)"
Tags
Grid
Asked by
Ken
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ken
Top achievements
Rank 1
Share this question
or