This question is locked. New answers and comments are not allowed.
Hello,
I have a Combobox binded to Model field and I want to use unobtrusive validation included with mvc 3.
This is the code:
The problem is that the client validation isn't performed.
Looking the code I find that the validation attributes are not associated with combobox control.
The output:
Thank you in advance.
Mirko
I have a Combobox binded to Model field and I want to use unobtrusive validation included with mvc 3.
This is the code:
<div class="formField"> @(Html.Telerik().ComboBoxFor(m => m.regioneID) .ClientEvents(events => { events.OnChange("onComboboxRegioneChange"); }) .BindTo(new SelectList(Anagrafiche.LoadRegioni(), "regioneID", "Descrizione")) .InputHtmlAttributes(new { style = "width: 100px" }) .HtmlAttributes(new { style = "width: 120px" }) ) @Html.ValidationMessageFor(model => model.regioneID)</div>Looking the code I find that the validation attributes are not associated with combobox control.
The output:
<div class="formField"> <div class="t-widget t-combobox t-header" style="width: 120px"><div class="t-dropdown-wrap t-state-default"><input class="t-input" id="regioneID-input" name="regioneID-input" style="width: 100px" type="text" /><span class="t-select t-header"><span class="t-icon t-arrow-down">select</span></span></div><input id="regioneID" name="regioneID" style="display:none" type="text" /></div> <span class="field-validation-valid" data-valmsg-for="regioneID" data-valmsg-replace="true"></span></div>Mirko