Hi!
I've a problem with the Telerik Dropdown component.
In my model the dropdown is rendered with this code:
@Html.Telerik().DropDownListFor(m => m.CoOwnerIdentifierDocumentType).BindTo(IdentifierDocumentTypeValueDescriptionProvider.Values.AddPleaseSelect(false)).Value(Model.CoOwnerIdentifierDocumentType == null ? null : Model.CoOwnerIdentifierDocumentType.ToString())
Some facts about what is what here:
- CoOwnerIdentifierDocumentType is a nullable enum type in the Model.
- The values coming from IdentifierDocumentTypeValueDescriptionProvider which provides a list of SelectListItems where the Value contains the textual representation of the enum member like "DrivingLicense" and the display text contains the localized text of that member.
- A "Please select" item is added to that list because it's nullable. The value for that item is null.
As I see you're generating an INPUT type TEXT element, and the problem I'm have is that if I submit my form I got an error message that "Please select" is not a valid value...
The problem caused by is that not a hidden field is used for the value provider but the input element itself.
What is the preferred way to bind to a nullable enum model member which has additional element(s) in the list?
Thanks,
Attila