Completed
Last Updated: 20 Nov 2014 18:16 by ADMIN
Vesselin
Created on: 14 Nov 2011 04:43
Category: Kendo UI for jQuery
Type: Feature Request
7
Add label option to DropDown and ComboBox controls
Please add labelText option to the DropDown and ComboBox controls so it would be easier to add labels instead of having to manipulate the data source (especially when using a remote data source) to insert a first option as a label. This is currently an annoyance with the Telerik Controls as well. Thank you.

Something simple like:

$('#Country').kendoDropDownList({...
  dataTextField: "CountryName",
  dataValueField: "CountryCode",
  labelText: "[Select Country]"
});

This would eliminate lots of unnecessary coding or messing with the .js files to implement this ourselves (and having to re-do it each time when upgrading).
5 comments
SivaKumar
Posted on: 05 Feb 2012 08:40
Hi I want Multiselect dropdown with check box template  pls give me sample code
ADMIN
Telerik Admin
Posted on: 10 Jan 2012 16:01
The good news is this feature will be implemented and will become part of the next major Kendo UI release.
Justin
Posted on: 02 Jan 2012 20:52
I completely agree with Vesselin. While not as complex a problem as he illustrated, simply having a label item in the drop downs list of choices is confusing from a users perspective. We were about to purchase Kendo to replace Infrigistics however this may put a halt on that plan.
ADMIN
Telerik Admin
Posted on: 16 Nov 2011 09:50
I understand your concerns, and they really make sense. Your feedback will be taken into consideration.
Vesselin
Posted on: 15 Nov 2011 19:46
Yeah but that's almost a hack to make it behave properly. The built-in ASP.NET MVC Helpers don't require this, hence code made to work with standard controls/helpers has to be completely re-written to work with Telerik/Kendo. They're not interchangeable because of this - a major draw-back. Furthermore, in my honest opinion, a dummy item only used for a label on a UI control has absolutely no place in any DataSource. It makes it extremely undesirable to use those controls for very large applications when having to inject an extra item on each list coming from your database, not to mention that most lists contain an ID (which in most cases can't be null or blank, so it has to be set to 0) and a Value so not only do you have to inject an extra item, most cases you have to also take into account values greater than 0 when validating. And sometimes 0 is an accepted value, sometimes it isn't. An empty label option with no value is how a drop down control should behave. Do we have value? No - required error. THEN if you need to further ensure your value is greater than 0, you can do so only when needed. There are other cases/scenarios where not having a simple label option or having to inject items makes it extremely undesirable to use those specific controls whatsoever.

I am currently in the process of stripping out all Telerik().DropDownListFor() controls and replacing them with basic Html.DropDownListFor() conrols from an ex co-worker's unfinished (and unvalidated) code because all his drop downs start with the first item from a list pulled from the database instead of blank option and there is no way to simply add a blank option without having to re-write so many controllers, each containing many, many Lists which will need to be modified to add extra value.

Had I went the route of injecting extra values, I would have also had to update all my corresponding ViewModel Data Annotations to take into account that values must be greater than 0 (having a label with no value would ensure in most cases that I either have a numeric value or have no value at all; having to perform an extra check to ensure the numeric value is not 0 makes this all even more unpractical).

I hope the dev team seriously considers implementing this as it really is a major draw-back, especially when it comes to large, complex applications that are complex enough as it is, having to do all that extra work to accommodate drop downs makes us not even want to use the drop downs at all. This one draw-back outweighs almost all benefits of using the controls. Would really hate this to be the case with Kendo if/when we decide to migrate to it for our production sites. I understand the difference between the Telerik MVC Helpers and pure HTML/JavaScript controls but the same issues exist whether dealing with .NET or just JavaScript.