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

Programmatic filter of radgrid using between

1 Answer 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ceetee
Top achievements
Rank 1
ceetee asked on 03 May 2012, 04:11 PM
Hi,
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')"
RadGrid2.MasterTableView.Rebind()

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')"
RadGrid2.MasterTableView.Rebind()

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

Thanks

Chris

1 Answer, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 03 May 2012, 07:01 PM
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
Tags
Grid
Asked by
ceetee
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Share this question
or