2

I am using custom paging in a RadGrid. It is working fine. But filter is not working as i want. So I thought of writing my own code for filter. But how could i get the filter text and the coloumn for which the filter was applied in the NeedDataSource event.

Chindu Krishna
  • 411
  • 5
  • 13

2 Answers2

5

I got the answer, but I forgot to update here. My bad...

The answer is: gridObject.MasterTableView.FilterExpression. This grid property has all the filters concatenated as a string. this string contains column headers and the filter applied separated by comma ,. You can split that and work on it.

Andrew
  • 7,602
  • 2
  • 34
  • 42
Chindu Krishna
  • 411
  • 5
  • 13
1

I found another way, which I discovered thanks to ckr's answer here. You need to do this for each filterable column you are interested in:

var filterValue = rgFilterPoints.MasterTableView.GetColumn("YourColumnName").CurrentFilterValue;

Another option, if you happen to be in an event whose EventArgs parameter has Item (like GridCommandEventArgs), you can use this:

((GridTableCell)e.Item.Cells[5]).Column.CurrentFilterValue

You need to use column index in this case. Beware there are a few "hidden" columns at the beginning, so in this example I'm accessing the 4th column in the markup.

Andrew
  • 7,602
  • 2
  • 34
  • 42