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

How to filter with Enum DataType

20 Answers 496 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 02 Jul 2010, 05:57 AM
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.

20 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 02 Jul 2010, 12:56 PM
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
0
Rod
Top achievements
Rank 1
answered on 04 Jan 2011, 08:59 PM
I would like to see this, I need this functionality as well to sort on the String representation of the enum.
0
Tsvetoslav
Telerik team
answered on 10 Jan 2011, 09:43 AM
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.
0
Greg
Top achievements
Rank 1
answered on 24 Feb 2011, 11:47 AM
Since you say there's no demand, I thought I'd better pipe up and say:

I need this too.

Greg.
0
Tsvetoslav
Telerik team
answered on 25 Feb 2011, 02:37 PM
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!
0
Theunis Janse van Vuuren
Top achievements
Rank 1
answered on 01 Mar 2011, 02:57 PM
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
0
Tsvetoslav
Telerik team
answered on 07 Mar 2011, 02:39 PM
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!
0
Martin
Top achievements
Rank 1
answered on 04 Apr 2011, 09:45 AM
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
0
Tsvetoslav
Telerik team
answered on 06 Apr 2011, 05:16 PM
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!
0
Ryan
Top achievements
Rank 1
answered on 09 May 2012, 09:55 PM
We need this functionality too. A quite common occurance.
0
Shivanshu
Top achievements
Rank 2
answered on 15 Feb 2013, 08:56 AM
Hi , is this information still valid ??
0
Tsvetoslav
Telerik team
answered on 18 Feb 2013, 01:09 PM
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.
0
Shivanshu
Top achievements
Rank 2
answered on 18 Feb 2013, 01:30 PM
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...  
0
Tsvetoslav
Telerik team
answered on 21 Feb 2013, 10:49 AM
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.
0
Kyle Smith
Top achievements
Rank 1
answered on 07 Jun 2013, 08:47 PM
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. 





0
Tsvetoslav
Telerik team
answered on 10 Jun 2013, 02:38 PM
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.
0
Arun
Top achievements
Rank 1
answered on 20 Feb 2014, 11:00 AM
Add me to the list of demand. I need this functionality too. Did you have any update on "Enum filtering" Issue ?
0
Vasil
Telerik team
answered on 25 Feb 2014, 09:48 AM
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.
0
Lutz
Top achievements
Rank 1
answered on 21 Oct 2014, 01:50 AM
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
0
Vasil
Telerik team
answered on 23 Oct 2014, 11:55 AM
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.

 
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Rod
Top achievements
Rank 1
Greg
Top achievements
Rank 1
Theunis Janse van Vuuren
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Ryan
Top achievements
Rank 1
Shivanshu
Top achievements
Rank 2
Kyle Smith
Top achievements
Rank 1
Arun
Top achievements
Rank 1
Vasil
Telerik team
Lutz
Top achievements
Rank 1
Share this question
or