Bahram Moinvaziri
Top achievements
Rank 1
Bahram Moinvaziri
asked on 18 Feb 2009, 11:41 PM
Hi,
How do i programmatically set the filter for a column that is defined as type System.Boolean? So, far i have this but it does not work. Please advise.
thank you,
Bahram
How do i programmatically set the filter for a column that is defined as type System.Boolean? So, far i have this but it does not work. Please advise.
thank you,
Bahram
FilterExpression filter = new FilterExpression();
filter.Predicates.Add(
FilterExpression.BinaryOperation.AND, GridKnownFunction.Contains, GridFilterCellElement.ParameterName);
filter.Parameters.Add(
GridFilterCellElement.ParameterName, "0");
this.radGView1.Columns["Active"].Filter = filter;
4 Answers, 1 is accepted
0
Hi Bahram,
Thanks for you questions.
You cannot filter a bool column by using the 'Contains' operation since the cells in this column can only have two values: true or false. Therefore the 'Contains' filter cannot be applied as you can apply it for text columns.
I hope this answers your question.
Kind regards,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for you questions.
You cannot filter a bool column by using the 'Contains' operation since the cells in this column can only have two values: true or false. Therefore the 'Contains' filter cannot be applied as you can apply it for text columns.
I hope this answers your question.
Kind regards,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bahram Moinvaziri
Top achievements
Rank 1
answered on 19 Feb 2009, 03:52 PM
Deyan,
We have purchased full support for a year, i expected a specific answer as to what the code should be to set the filter for a boolean column. Your response was stating the obvious or my question was not specific enought? Please don't bother answering if you don't know.
thank you,
Bahram
0
Hello Bahram,
I am sorry for the lack of details in my answer. It might had happened that I did not understand you correctly.
I would also like to thank you for purchasing our suite. We do strive to do our best to make our customers satisfied.
I have prepared a sample project that demonstrates how you can programmatically create a filter for a bool column in the RadGridView control. Please focus on this code snippet which is part of the project:
In my demo project I added the possibility for you to filter both the 'True' or 'False' values and to clear the filtering as well. I hope the code within the project will be helpful for you.
If this still does not help, please get back to me with further details (simple demo project) that may help me guide you through.
Note, that if you want to be able to attach a project you will have to open a new support ticket.
All the best,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am sorry for the lack of details in my answer. It might had happened that I did not understand you correctly.
I would also like to thank you for purchasing our suite. We do strive to do our best to make our customers satisfied.
I have prepared a sample project that demonstrates how you can programmatically create a filter for a bool column in the RadGridView control. Please focus on this code snippet which is part of the project:
private void AddFilter() |
{ |
FilterExpression expression = new FilterExpression(); |
expression.Predicates.Add( |
Telerik.WinControls.Data.FilterExpression.BinaryOperation.OR, |
Telerik.WinControls.UI.GridKnownFunction.EqualTo, |
true); |
this.radGridView1.Columns[0].Filter = expression; |
} |
In my demo project I added the possibility for you to filter both the 'True' or 'False' values and to clear the filtering as well. I hope the code within the project will be helpful for you.
If this still does not help, please get back to me with further details (simple demo project) that may help me guide you through.
Note, that if you want to be able to attach a project you will have to open a new support ticket.
All the best,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bahram Moinvaziri
Top achievements
Rank 1
answered on 19 Feb 2009, 06:39 PM
Thank you for yourprompt reply!!! This is exactly what I waslooking for. The last parameter needs to be either true or false with theoperation EqualTo. I had EqualTo at first but then I started testing othersettings. At the time I wrote my forum post, I had already searched the forumand docs and found no answer. The only things is that you are using the OR operation(I mean Telerik.WinControls.Data.FilterExpression.BinaryOperation.OR) and I am using theAND operation.