Binding Nullable field to DropDownList editor in Grid

Thread is closed for posting
1 posts, 0 answers
  1. Kendo UI
    Kendo UI avatar
    322 posts
    Member since:
    Aug 2011

    Posted 04 Mar 2013 Link to this post

    Requirements

    Kendo UI Suite and Version

    2012.3.1315

    jQuery Version

    1.8.2

    Supported Browsers and Platforms

    All supported by Kendo UI

    Components/Widgets used 

    Grid, DropDownList
    ASP.NET MVC version
     3.0

    PROJECT DESCRIPTION 
    This code library project demonstrates how to implement custom binding and disable the default value binding for a DropDownList(or ComboBox) in order to always set the value. This approach can be used to avoid the default value binding behavior to update the field with the selected item when the initial value is null.

    Since the Q2 2013 release, creating a custom binding is not needed and it is enough to set the data-value-primitive attribute to true on the input with the HtmlAttributes method. For example:
    Html.Kendo().DropDownListFor(m => m)
        .HtmlAttributes(new { data_value_primitive = "true" })

Back to Top