Hi,
When using a complex model, validation does not occur (both client (Kendo UI) as well as server) -- only on the Editor helper; my other Kendo UI controls work fine. Any thoughts on why? I'm assuming it has something to do with the name and/or ID of the control.
I've included relevant code. Let me know if you need more info.
View:
<
div
class
=
"form-group"
>
@Html.LabelFor(m => m.Change.Description, new { @class = "col-sm-3 control-label" })
<
div
class
=
"col-sm-9"
>
@Html.EditorFor(m => m.Change.Description)
</
div
>
<
div
class
=
"col-sm-offset-3 col-sm-9"
>
@Html.ValidationMessageFor(m => m.Change.Description)
</
div
>
</
div
>
Model:
public
class
CreateChangeViewModel
{
public
CreateChangeModel Change {
get
;
set
; }
}
public
class
CreateChangeModel
{
[Display(Name =
"Change Implementing"
)]
[Required(ErrorMessage =
"You must enter a description of the change."
)]
[UIHint(
"TextArea"
)]
public
string
Description {
get
;
set
; }
}
Editor Template (TextArea.cshtml):
@Html.Kendo().EditorFor(model => model).HtmlAttributes(
new
{ style =
"width: 100%; height: 200px;"
}).Resizable(
true
)
Thanks!