We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Row Filter

Thread ID:

Created:

Updated:

Platform:

Replies:

72473 Mar 20,2008 11:32 AM Mar 25,2008 05:28 PM Windows Forms 1
loading
Tags: GridControl
James Gramosli
Asked On March 20, 2008 11:32 AM

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 + ") ";
}


Administrator [Syncfusion]
Replied On March 25, 2008 05:28 PM

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;