How to filter with Enum DataType

21 posts, 0 answers
  1. Peter
    Peter avatar
    15 posts
    Member since:
    Jul 2007

    Posted 02 Jul 2010 Link to this post

    Hi Guys,
    I have problems when I filter with enum datatype.
    my code sample is:
    1) enum Days {Sat, Sun, Mon, Tue, Wed, Thu, Fri};
    
    public class Person
    {
      public Person()
      {}
      public Days DayAbsent
      {
    get;
    set;
      }
    Public FirstName
    .............
    }

    2) In RadGrid I have a column:
    <telerik:GridBoundColumn SortExpression="DayAbsent" HeaderText="Day Absent" HeaderButtonType="TextButton"
                            DataField="DayAbsent" AllowFiltering="true">
                        </telerik:GridBoundColumn>
    3) when I run filter of this column, I see error message:
    [Telerik.Web.UI.ParseException] = {"Neither of the types 'String' and 'Days' converts to the other"}

    Could you tell me how to fix this issue.
    Thanks,
    Peter.
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 02 Jul 2010 Link to this post

    Hi aladin,

    I am afraid filtering on an EnumType column is not a supported scenario.

    Regards,
    Tsvetoslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rod
    Rod avatar
    1 posts
    Member since:
    Dec 2010

    Posted 04 Jan 2011 Link to this post

    I would like to see this, I need this functionality as well to sort on the String representation of the enum.
  5. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 10 Jan 2011 Link to this post

    Hello Peter,

    Unfortunately, our development team has deemed this feature not one of its priorities for the improvements in RadGrid based on very low, almost nonexistent, customer demand and the scale of the effort.

    Greetings,
    Tsvetoslav
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Greg
    Greg avatar
    4 posts
    Member since:
    Jul 2010

    Posted 24 Feb 2011 Link to this post

    Since you say there's no demand, I thought I'd better pipe up and say:

    I need this too.

    Greg.
  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 25 Feb 2011 Link to this post

    Hello Greg,

    Thanks for that  - we shall have it in mind.

    Best wishes,
    Tsvetoslav
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  8. Theunis Janse van Vuuren
    Theunis Janse van Vuuren avatar
    5 posts
    Member since:
    Oct 2009

    Posted 01 Mar 2011 Link to this post

    Make that three, add me to the list of demand.

    We are running an application that has a Workflow tied to accounts, each account has a status and the description for the Status can get lengthy to type out for the users.

    There are only a few set statuses that I can easily add as enums. Being able to Filter by those would be a huge win.

    I am thinking of overriding the binding event for that Col client side and inserting DropDowns with the valid string value as the value and text field. Just not to sure where to start digging. Im not to phased about having events tied to the DropDown, only want to save the client the time in typing 'Account 1st Stage Verified' each time they want to see the accounts for that status.

    So yes +1 me with an upsize...

    Theunis
  9. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 07 Mar 2011 Link to this post

    Hi Chan,
    hi Theunis, Greg and Rod,

    Our development team researched the issue - unfortunately, RadGrid's design does not allow for the implementation of the feature under this support discussion. I am attaching a small sample that may provide some guidelines on how to work around this problem in some scenarios.

     

    Greetings,
    Tsvetoslav
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  10. Martin
    Martin avatar
    20 posts
    Member since:
    Nov 2010

    Posted 04 Apr 2011 Link to this post

    Has anything improved with Q1 2011 on filtering of Enums ?

    Unfortunately it's quite common to use eNums in C# and to need to bind objects containing enum properties to the Telerik grid.

    Whilst the values display ok in the grid the filters offer integer choices only rather than a selection list of the string equivalents. Also when editing values in cells it is the integer values that are requested (unfamiliar to the users of a system).

    Martin
  11. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 06 Apr 2011 Link to this post

    Hi Martin,

    My last post is still valid.

    All the best,
    Tsvetoslav
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  12. Ryan
    Ryan avatar
    1 posts
    Member since:
    May 2012

    Posted 09 May 2012 Link to this post

    We need this functionality too. A quite common occurance.
  13. Shivanshu
    Shivanshu avatar
    4 posts
    Member since:
    Nov 2012

    Posted 15 Feb 2013 Link to this post

    Hi , is this information still valid ??
  14. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 18 Feb 2013 Link to this post

    Hi Shivanshu,

    Yes, it is.

    Regards, Tsvetoslav
    the Telerik team
    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 their blog feed now.
  15. Shivanshu
    Shivanshu avatar
    4 posts
    Member since:
    Nov 2012

    Posted 18 Feb 2013 Link to this post

    Thanks for update dear .. Any better work around for this ..Can you recommend any code spinet or blog or something which you think useful in this scenario...  
  16. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 21 Feb 2013 Link to this post

    Hi Chan,

    The sample provided in my post from 2011 is a working one and provides a work-around to the filtering of enums. Once again, RadGrid does not support this scenario out-of-the-box.

    Greetings, Tsvetoslav
    the Telerik team
    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 their blog feed now.
  17. Kyle Smith
    Kyle Smith avatar
    42 posts
    Member since:
    Feb 2012

    Posted 07 Jun 2013 Link to this post

    It is a bit disappointing that Enum filtering is not supported. I would recommend you re-evaluate the need for this type of support given the fact that the Entity Framework now supports Enums (I think as of 4.1?) AND since the RadGrid supports binding against the Entity Data Source.

    I think you'll find that Enums are very popular when using the Entity Framework Code First approach. It would be SUPER useful if your development team could find a way to support this. It would make an already great control even greater!

    Please add a +1 to this feature request for me!

    In the meantime, I guess I'll have to convert to using OnNeedDataSource and convert my Entities to a DataTable. 





  18. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 10 Jun 2013 Link to this post

    Hi Kyle,

    Do share your feedback at http://www.telerik.com/feedback.aspx .
     
    Regards,
    Tsvetoslav
    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.
  19. Arun
    Arun avatar
    4 posts
    Member since:
    Jun 2013

    Posted 20 Feb 2014 Link to this post

    Add me to the list of demand. I need this functionality too. Did you have any update on "Enum filtering" Issue ?
  20. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 25 Feb 2014 Link to this post

    Hello Arun,

    You can still work the workarownd provided by Tsvetoslav. Up to this date the Enum can not be filtered out of the box.

    Regards,
    Vasil
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  21. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 20 Oct 2014 Link to this post

    Well, it's over two years later, and I also need the ability to filter on enums. Very surprised that this is not a supported scenario... Any changes? I looked on the Feedback site, but did not see any item relating to this....

    - Lutz
  22. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 23 Oct 2014 Link to this post

    Hi Lutz,

    We do not planing to implement such filtering. We put some effort in research and it turns out that this is not possible to be built-in.

    You will need to cast the enum to string in order to filter by it. Here is another forum that discuss possible workaround:
    http://www.telerik.com/forums/radgrid-filtering-nullable-enums

    Regards,
    Vasil
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017