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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl - Custom filters with logical expressions on multiple columns

Thread ID:





102268 Jan 16,2012 10:15 AM UTC Jan 20,2012 10:52 AM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Vijay Jayaraj
Asked On January 16, 2012 10:15 AM UTC


I am using GridGroupingControl(asp.net) , I would like to have custom(record) filters on multiple columns with [OR] conditions. Currently the Record filters are working like [AND] condition on multiple columns. Below query is my requirement from coding.

Query - 1:

Get all the records where the 'user1' is present in any of the columns like column1 or column2 or column3.

Query - 2:

Get all the records within date range(start date to end date),
applying expressions to filters.

Also Please suggest the userguide for gridgroupingcontrol.

Sridhar N [Syncfusion]
Replied On January 20, 2012 10:52 AM UTC

Hi Vijay,

Thanks for your patience.

Query #1 "Get all the records where the 'user1' is present in any of the columns like column1 or column2 or column3."

Your requirement can be achieved by adding recordfilters with expertssion. Please refer the below code snippet.

[Codebehind - C#]

void UserFilter_Click(object sender, EventArgs e)
RecordFilterDescriptor rfd = new RecordFilterDescriptor();
StringBuilder sb = new StringBuilder();
foreach (GridVisibleColumnDescriptor gcd in this.GridGroupingControl1.TableDescriptor.VisibleColumns)
sb.AppendFormat("[{0}] like '*{1}*' OR ", gcd.Name, "User1");
//'remove last ' OR '
sb.Remove(sb.Length - 4, 4);
rfd.Expression = sb.ToString();

Query #2 "Get all the records within date range(start date to end date),applying expressions to filters."

Your requiement can be achieved by using logical operator. Please refer the below code snippet.

[Codebehind - C#]

void DateFilter_Click(object sender, EventArgs e)
GridRecordFilterDescriptor filter2 = new GridRecordFilterDescriptor();
filter2.Name = "Dates";
filter2.LogicalOperator = FilterLogicalOperator.And;
filter2.Conditions.Add(Syncfusion.Grouping.FilterCompareOperator.GreaterThan, "3/24/2005");
filter2.Conditions.Add(Syncfusion.Grouping.FilterCompareOperator.LessThan, "5/10/2005");

For your convenience, we have created sample and the same can be downloaded from the following link.

Custom Filter-1812399385.zip

Please let me know if you have any other questions or concerns.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon