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. Image for the cookie policy date
close icon

AND Filter in the grid filter bar.

How do I write an AND filter on the Syncfusion Grid filter bar?

I have tried the following, but they did not work:

1) (>10) && (<1000)
2) (>10) AND (<1000)

Basically I am trying to specifiy a range filter, where I can see the rows where the specific column value is between 10 and 1000.
Please advise.
Thanks for your help.



4 Replies

SR Sri Rajan Syncfusion Team January 31, 2008 10:56 PM UTC

Hi Digant,

Thank you for your continued interest in Syncfusion products.

Please refer to the attached sample, that will show you how to specifiy a range filter(between 10 to 10000)
http://websamples.syncfusion.com/samples/Grid.Windows/F71462/main.htm

Please let me know if this helps.

Regards,
Srirajan




DI Digant February 1, 2008 02:21 PM UTC

Hi Srirajan,
Thank you for your reply.
However, we are trying to apply the below mentioned filter in the grid, not through the source code.
That is, we would want to open up the filter bar on the grid and type in a filter string there.

Please advise.
Thanks again for your help.

>Hi Digant,

Thank you for your continued interest in Syncfusion products.

Please refer to the attached sample, that will show you how to specifiy a range filter(between 10 to 10000)
http://websamples.syncfusion.com/samples/Grid.Windows/F71462/main.htm

Please let me know if this helps.

Regards,
Srirajan






DI Digant February 5, 2008 06:01 PM UTC

Any updates on the below?
Please advise.
Thanks.

>Hi Srirajan,
Thank you for your reply.
However, we are trying to apply the below mentioned filter in the grid, not through the source code.
That is, we would want to open up the filter bar on the grid and type in a filter string there.

Please advise.
Thanks again for your help.

>Hi Digant,

Thank you for your continued interest in Syncfusion products.

Please refer to the attached sample, that will show you how to specifiy a range filter(between 10 to 10000)
http://websamples.syncfusion.com/samples/Grid.Windows/F71462/main.htm

Please let me know if this helps.

Regards,
Srirajan








SR Sri Rajan Syncfusion Team February 7, 2008 01:32 AM UTC

Hi Digant,

Thank your for your continued interest in Syncfusion products.

Currently there is no inbuild support available to open up the filter bar on the grid and type in a filter string there. but we can achieve this through code by inherit the GridFilterBar. Please refer to the below code that shows how to apply the below mentioned filter in the grid.


private string BuildFilterString()
{
GridCurrentCell cc = _grid.CurrentCell;
string s;
string filter = "";
string s1, s2;
for(int i = 1; i <= _grid.Model.ColCount; ++i)
{
if(i == cc.ColIndex)
s = cc.Renderer.ControlText;
else
s = _grid[cc.RowIndex, i].Text;
if(s.Length > 0)
{
string gridMappingName = _grid.Binder.InternalColumns[_grid.Binder.ColIndexToField(i)].MappingName;
if (gridMappingName == "Rate")
{
if (s.Length > 2 && Convert.ToBoolean(s.IndexOf('-')) && s.IndexOf('-') != s.Length - 1)
{
s1 = s.Substring(0, s.IndexOf('-'));
s2 = s.Substring(s.IndexOf('-') + 1, s.Length - s.IndexOf("-") - 1);
filter = filter.Replace("AND", "AND [{0}] ");
filter = filter + string.Format("[{0}]>" + s1 + " AND [{0}]<" + s2, gridMappingName, s);
}
}
}
}
return filter;
}


Please refer to the attached sample for more details.
Sample

Note:
*In this sample Criteria should be in this format Value1-Value2
Example: 10-20

Please let me know if this helps.

Regards,
Srirajan




Loader.
Live Chat Icon For mobile
Up arrow icon