I'm new to KendoUI, so I'm probably doing something stupid. When using the MVC wrapper and creating a control:
I'm not getting any data-val attributes rendered on the controls. This goes for all controls that I'm creating, not just the drop down list. All of my Kendo controls are not generating data-val attributes.
I'm sure my model is correct, as when adding the line:
@Html.TextBoxFor(m => m.CardPayment.State)
directly under the above control, the data-val attributes are generated correctly.
Am I missing something?
Thanks.
@(Html.Kendo().DropDownListFor(m => m.CardPayment.State)
.OptionLabel(
"Select state..."
)
.BindTo(
new
SelectList(Model.States,
"Abbreviation"
,
"Name"
))
.DataTextField(
"Text"
)
.DataValueField(
"Value"
)
.HtmlAttributes(
new
{ value = Model.CardPayment.State })
)
I'm not getting any data-val attributes rendered on the controls. This goes for all controls that I'm creating, not just the drop down list. All of my Kendo controls are not generating data-val attributes.
<
span
tabindex
=
"0"
style
=
""
unselectable
=
"on"
class
=
"k-widget k-dropdown k-header"
><
span
unselectable
=
"on"
class
=
"k-dropdown-wrap k-state-default"
><
span
unselectable
=
"on"
class
=
"k-input"
>Select state...</
span
><
span
class
=
"k-select"
><
span
class
=
"k-icon k-i-arrow-s"
>select</
span
></
span
></
span
><
input
id
=
"CardPayment_State"
name
=
"CardPayment.State"
type
=
"text"
value
=
""
data-role
=
"dropdownlist"
style
=
"display: none; "
></
span
>
I'm sure my model is correct, as when adding the line:
@Html.TextBoxFor(m => m.CardPayment.State)
directly under the above control, the data-val attributes are generated correctly.
<
input
data-val
=
"true"
data-val-required
=
"You must enter the billing state for the card."
id
=
"CardPayment_State"
name
=
"CardPayment.State"
type
=
"text"
value
=
""
>
[Display(Name =
"State"
)]
[Required(ErrorMessage =
"You must enter the billing state for the card."
)]
[DataMember]
public
string
State {
get
;
set
; }
Am I missing something?
Thanks.