I have a model with SourceId, LanguageId, OriginalLanguageId, which are bound to some dropdownlists, using :
01.@(Html.Kendo().DropDownListFor(m => m.SourceId)02. .DataTextField("Name")03. .DataValueField("Id")04. .ValuePrimitive(true) <------ Here be dragons?05. .Animation(false).AutoBind(false)06. .HtmlAttributes(new07. {08. @class = "form-control",09. data_bind = "value: regulation.SourceId"10. })11. .OptionLabel("Please select a source")12. .Filter(FilterType.Contains)13. .DataSource("sourcesDataSource")14.)15. 16.@(Html.Kendo().DropDownListFor(m => m.LanguageId)17. .DataTextField("Name")18. .DataValueField("Id")19. .Animation(false).AutoBind(false)20. .HtmlAttributes(new21. {22. @class = "form-control",23. data_bind="value: regulation.LanguageId"24. })25. .OptionLabel("Please select the official language")26. .Filter(FilterType.Contains)27. .DataSource("languagesDataSource")28.)01.@(Html.Kendo().DropDownListFor(m => m.OriginalLanguageId)02. .DataTextField("Name")03. .DataValueField("Id")04. .Animation(false).AutoBind(false)05. .HtmlAttributes(new06. {07. @class = "form-control",08. data_bind="value: regulation.OriginalLanguageId"09. })10. .OptionLabel("Please select the original language")11. .Filter(FilterType.Contains)12. .DataSource("languagesDataSource")13.)
All 3 fields are int, non nullable, yet only LanguageId and OriginalLanguageId are bound and displayed/selected in their dropdowns.
The data structures for Language and Source have only {Id: int, Name: string}.
SourceId is bound, but is not displayed/selected, unless I set ValuePrimitive(true).
I see that it is bound because when I click the dropdown, the value is selected in the list.
So I would like to understand why do I have to set ValuePrimitive(true) only for a field.
Thank you.
