This is a migrated thread and some comments may be shown as answers.

DropDownList not showing client side validation message

2 Answers 319 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
johnsk
Top achievements
Rank 1
johnsk asked on 25 Apr 2012, 05:00 AM
Hello guys!

I cannot get kendo dropdownlist to show builtin mvc validation message on client side when clicking submit button.
If i remove the kendo initializer the dropdownlist gets rendered as default html select and the validation message is showing client side when clicking submit button.
Strange thing the builtin mvc validation message works for other kendo initialized controls like calendar or autocomplete, but cant get it to work for dropdownlist.
I'm stuck on this one and would surely appreciate your help guys :)

The model entity Person has a int field CompanyID with validation attribute [Required]. 
The view markup is as follows.
....................................................... 
@Html.DropDownListFor(m => m.CompanyID, (IEnumerable<SelectListItem>)ViewBag.CompanyID)
 @Html.ValidationMessageFor(m => m.CompanyID)
.......................................................
 $(document).ready(function () {
$("#CompanyID").kendoDropDownList()  
});
....................................................... 

2 Answers, 1 is accepted

Sort by
0
GungFooMon
Top achievements
Rank 1
answered on 25 Apr 2012, 08:53 AM
Hi!

Try adding a validation rule manually as described here:

http://www.kendoui.com/documentation/framework/validator/overview.aspx
0
johnsk
Top achievements
Rank 1
answered on 25 Apr 2012, 10:34 AM
Thanks for reply, but the magic word here is manual vs automatic validation already built in MVC and Entity Framework models.
I am trying to use existing MVC validation infrastructure with kendo ui layer.
Has anybody accomplished this so far ?




Tags
DropDownList
Asked by
johnsk
Top achievements
Rank 1
Answers by
GungFooMon
Top achievements
Rank 1
johnsk
Top achievements
Rank 1
Share this question
or