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

RadFilterTextFieldEditor and System.Guid Error

1 Answer 27 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 22 Aug 2013, 12:43 PM

I've been working with the RadFilter, and have added a RadFilterTextFieldEditor to the RadFilter which is set to a DataType of System.Guid.  When I pass the expression into a LinqDynamic query, it throws an exception:

ParseException:
Operator '==' incompatible with operand types 'Guid' and 'Object'

The RadFilter expression:
"(iif(it.UniqueId==null,\"\",it.UniqueId).ToString().ToUpper() = \"12345678-926F-44A9-936B-CDBB03DA888A\".ToUpper())"

Declarative code:
<telerik:RadFilterTextFieldEditor DataType="System.Guid" FieldName="UniqueId" DisplayName="Package Unique ID" />

Linq Query:

if (!string.IsNullOrEmpty(packageFilterExpression))

{

query = query

   .Where(packageFilterExpression);

}


Note:  I have researched this some and arrived at the following suggested workaround, however the suggestion to modify the LinqDynamic class in this case still doesn't work with the expression syntax generated by the RadFilter.

https://connect.microsoft.com/VisualStudio/feedback/details/333262/system-linq-dynamic-throws-an-error-when-using-guid-equality-in-where-clause

Additionally, when I add filtering to a RadGrid, to see how it generates a filter expression, I see that the expression is different, and consequently works.

The RadGrid expression:

"(UniqueId = Guid(\"12345678-926F-44A9-936B-CDBB03DA888A\"))"

Any assistance or verification the RadFilter actually works with a System.Guid would be appreciated!

Thanks!

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 27 Aug 2013, 08:34 AM
Hello Todd,

Thank you for sharing this issue. I have logged it to our tracking system so that our dev team could further research on the problem and do their best to isolate its root cause. Meanwhile as a possible workaround you could use the new delegate of all Query Providers "OnExpressionEvaluated" to change the expression so that it works as expected.

As a token of gratitude for sharing this issue you will find your Telerik points updated.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Filter
Asked by
Todd
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or