This is a migrated thread and some comments may be shown as answers.

How to use IsGreaterThan with string length.

0 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nischal
Top achievements
Rank 1
Nischal asked on 15 Jun 2012, 01:41 PM
Hi!
I have a RadGridview where i have few columns and based on this column  i have to sort only those columns whose length is greater than 4 if the rows have string with length less than 4 those should not be visible.

I tried using CompositeFilterDescriptor but it does not filter for string with length less than 4.
I tried the following code.

                This Code works fine:
              CompositeFilterDescriptor FilterAnd = new CompositeFilterDescriptor();
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustName", FilterOperator.IsNotEqualTo, ""));
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustName", FilterOperator.IsNotEqualTo, null));
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustAddress", FilterOperator.IsNotEqualTo, ""));
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustAddress", FilterOperator.IsNotEqualTo, null));
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustCity", FilterOperator.IsNotEqualTo, ""));
                FilterAnd.FilterDescriptors.Add(new FilterDescriptor("CustCity", FilterOperator.IsNotEqualTo, null));
                FilterAnd.LogicalOperator = FilterCompositionLogicalOperator.And;

                This code is not working:
                CompositeFilterDescriptor FilterOr = new CompositeFilterDescriptor();
                FilterOr.FilterDescriptors.Add(new FilterDescriptor("CustName", FilterOperator.IsGreaterThan, 4));
                FilterOr.FilterDescriptors.Add(new FilterDescriptor("CustAddress", FilterOperator.IsGreaterThan, 4));
                FilterOr.FilterDescriptors.Add(new FilterDescriptor("CustCity", FilterOperator.IsGreaterThan, 4));
                FilterOr.LogicalOperator = FilterCompositionLogicalOperator.Or;

                grid.FilterDescriptors.Add(FilterAnd);
                grid.FilterDescriptors.Add(FilterOr);

How can i use IsGreaterThan with string length can any one help me?

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Nischal
Top achievements
Rank 1
Share this question
or