Binding Nullable field to DropDownList editor in Grid

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

    Posted 04 Mar 2013 Link to this post


    Kendo UI Suite and Version


    jQuery Version


    Supported Browsers and Platforms

    All supported by Kendo UI

    Components/Widgets used 

    Grid, DropDownList
    ASP.NET MVC version

    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

This Code Library is part of the product documentation and subject to the respective product license agreement.