How to bind type Dictionary to Kendo Combobox?
@(Html.Kendo().ComboBox()
.Name("Division")
.DataTextField("Key")
.DataValueField("Value")
.BindTo(Model.Filter.DivisionList)
)
Model.Filter.DivisionList is Dictionary With above code I have an error "not supported for serialization/deserialization of a dictionary, keys must be strings or objects."
Is there a simple workaround for this issue?
This worked for me:
.Name("PaymentTerm"
).BindTo(
new SelectList(Model.CreditCollectionInfo.PaymentTerms.Select(
s => new {
Key = s.Key,
Value = s.Value
}
), "Key", "Value")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With