Binding Nullable field to DropDownList editor in Grid
Cancel
The title field is required!
Thread is closed for posting
1
posts,
0
answers
-
AA935EF1-0CA8-4FFB-84B0-095C38A68F6E
165
posts
Member since:
Aug 2011
Posted 04 Mar 2013
Link to this post
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"
})
-