0

Set data into kendo dropdown from model while loading

@(Html.Kendo().DropDownListFor(m => m.CaseValue)
                                            .DataTextField("Text")
                                            .DataValueField("Value")
                                            .Filter("contains")
                                            .BindTo(Model.CaseList)
                                            .HtmlAttributes(new { @style="width:100%;" })
                                            //.SelectedIndex(0)
                                            .Value(Model.CaseValue)
                                            .Events(e =>
                                            {
                                                e.Change("onCaseValueChange");
                                                //e.DataBound("fnSetCaseType");
                                            })
                                        )

As per the below link https://demos.telerik.com/aspnet-mvc/dropdownlist I guess i am trying correctly to load data from model using .Value(Model.CaseValue) but no luck. Thanks in advance.

Anuj
  • 51
  • 3
  • What is `Model.CaseList` and `Model.CaseValue`? Could you show how they are populated? – JamesS Oct 02 '19 at 10:46
  • @JamesS Model.CaseList is a list of items and Model.CaseValue contains value which is supposed to be selected in Dropdownlist while loading. For example CaseList is item1, item2, item3... and CaseValue is item3 so while loading item3 should be selected in Dropdownlist. – Anuj Oct 02 '19 at 12:01
  • Could you show the code for the implementation of `Model.CaseList` though – JamesS Oct 02 '19 at 12:06

0 Answers0