Row Filter

Hey guys,
I'm trying to get a chart which displays the same data as the grid, so to do this I need to get the row filter from the grid.

I havent been able to find the row filter property of a filtered row. I've resorted to writing something like this which loops through the RecordFilters collection of the table descriptor.
This is bound to cause bugs so I dont really want to use it, dont you guys have something somewhere that returns the DataView.RowFilter value? You have to do a similar construction of this string somewhere.

string rowFilter = String.Empty;
string valueFilter = String.Empty;
string seperator = String.Empty;
foreach ( RecordFilterDescriptor recFilter in gridTable.TableDescriptor.RecordFilters )
{
rowFilter += recFilter.LogicalOperator.ToString() + " " + recFilter.FieldDescriptor.Name + " IN( ";
//If its a string then wrap each value with '.
if ( recFilter.FieldDescriptor.FieldPropertyType == typeof( string ) || recFilter.FieldDescriptor.FieldPropertyType == typeof( DateTime ))
seperator = "'";
else
seperator = String.Empty;

foreach ( FilterCondition filtCond in recFilter.Conditions )
{
if ( !String.IsNullOrEmpty( valueFilter ) )
{
valueFilter += ",";
}
valueFilter += seperator + filtCond.CompareValue + seperator;
}
rowFilter += valueFilter + ") ";
}


1 Reply

AD Administrator Syncfusion Team March 25, 2008 09:28 PM UTC

Hi James,

Thank you for your patience.

Please refer the code below to get the rowfileter of the GridGroupingControl.


DataView dv = new DataView(this.gridGroupingControl1.DataSource as DataTable);
Console.WriteLine(dv.RowFilter);


Please let me know if this helps.

Best Regards,
Srirajan



Loader.
Up arrow icon