Programmatic filter of radgrid using between

2 posts, 0 answers
  1. ceetee
    ceetee avatar
    4 posts
    Member since:
    Sep 2012

    Posted 03 May 2012 Link to this post

    I have a grid, with a column called ProcessName, which contains data from various processes.

    In the codebehind, i can successfully create a filter like so:
    column = RadGrid2.MasterTableView.GetColumnSafe("ProcessName")
    column.CurrentFilterFunction = GridKnownFunction.EqualTo
    column.CurrentFilterValue = cboProductSelectedValue
    RadGrid2.MasterTableView.FilterExpression = "([ProcessName] = 'Process1')"

    This filters the grid as you would expect.
    I wish to find 2 values in the column, and believe I should use BETWEEN but i'm unsure of the syntax. I changed the code to:

    column = RadGrid2.MasterTableView.GetColumnSafe("ProcessName")
    column.CurrentFilterFunction = GridKnownFunction.Between
    column.CurrentFilterValue = "Process1 Process2"
    RadGrid2.MasterTableView.FilterExpression = "([ProcessName] BETWEEN 'Process1 Process2')"

    but it doesn't work. Could anyone help me please? 


  2. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 03 May 2012 Link to this post

    I put a breakpoint on a simple filter (between a and b on a text field) and got this
    "((Convert.ToString(it["StoreName"]).ToUpper() >= "a".ToUpper()) AND ( Convert.ToString(it["StoreName"]).ToUpper() <= "b".ToUpper()))"
    so I would change your filter expression to be something like
    [ProcessName] >= "value of Process1" AND [ProcessName] <= "value of Process2"

    I don't think the double quotes around the column name are required unless you have imbedded spaces (for shame!) but the brackets are
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top