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

[Solved] Grid Filter bug?

1 Answer 123 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tyree
Top achievements
Rank 2
Tyree asked on 22 Jan 2011, 05:28 AM
Perhaps this is "as intended" but I found it very confusing until I figured it out.

A couple of columns in my grid are DataMemberBinding="{Binding SomeObject}" where SomeObject has a .ToString() that happens to be a useful value in a display only sense - so at first glance it seems right. The cell happens to have an edit template. So, on that column if you click the filter funnel it shows your filter stuff, but if I type in a value to filter on, when I leave that textbox it resets to empty and I can't filter except on distinct. It also does not have the "match case" button next to the textbox.

If I change the binding to {Binding SomeObject.SomeStringProperty} then the filter performs as expected.

So, if this is "as intended" perhaps you could simply not show the fields since you can't use them anyway - as it is now. Or make it work as it does when bound to a string.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 24 Jan 2011, 09:51 AM
Hi Tyree,

The whole filtering process is based on the Type of the underlying column, i.e. if it is a string you will get the StringFilterEditor (text-box + match case toggle button), if it is DateTime you will get a RadDateTime picker, and so on.

So if the type is none of the "known" ones (string, DateTime, numeric, enum) you are presented with a simple TextBox. When you enter some text in this text-box, our code will try to convert it from string to the respective custom type. If it fails, the text-box value will be cleared.

So you have three options.

1. You can develop a TypeConverter that will be able to convert your Type to and from string.
2. You can add another property to your POCO that will be this string representation. Then bind the column to this new prop. This will save you a lot of hassle.
3. Develop your very own filtering control that will "know" how to handle your specific Type. This is the most powerful approach since it gives you full control over what is going on in the filtering control. Here is a tutorial.

I hope this helps.

Kind regards,
Ross
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Tyree
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Share this question
or