RadFilterTextFieldEditor and System.Guid Error

2 posts, 0 answers
  1. Todd
    Todd avatar
    2 posts
    Member since:
    May 2011

    Posted 22 Aug 2013 Link to this post


    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!
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top