DropDownList not showing client side validation message

3 posts, 0 answers
  1. johnsk
    johnsk avatar
    8 posts
    Member since:
    Sep 2012

    Posted 25 Apr 2012 Link to this post

    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. GungFooMon
    GungFooMon avatar
    17 posts
    Member since:
    Apr 2012

    Posted 25 Apr 2012 Link to this post

    Hi!

    Try adding a validation rule manually as described here:

    http://www.kendoui.com/documentation/framework/validator/overview.aspx
  3. johnsk
    johnsk avatar
    8 posts
    Member since:
    Sep 2012

    Posted 25 Apr 2012 Link to this post

    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 ?




Back to Top