This is a migrated thread and some comments may be shown as answers.

Bug? DropDownList not rendering binding to IDictionary<string,string> in MVC

1 Answer 67 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 24 Jul 2013, 06:14 PM
Using this code I bind to a IDictionary<string,string> that has one item:

@(Html.Kendo().DropDownList()
      .Name("SelectedClientIdKendo")
      .HtmlAttributes(new { style = "width:200px" })
      .DataTextField("Key")
      .DataValueField("Value")
      .BindTo(Model.ClientList)
      )
The HTML looks ok that is rendered by the MVC wrapper, but the dropdownlist doesn't visually show any items in the list:

      <input id="SelectedClientIdKendo" name="SelectedClientIdKendo" style="width:200px" type="text" />
<
script>
    jQuery(function(){jQuery("#SelectedClientIdKendo").kendoDropDownList({"dataSource":{"2XXXXX":"2YYYYY"},"dataTextField":"Key","dataValueField":"Value"});});
</script>
                

1 Answer, 1 is accepted

Sort by
0
Accepted
Ian
Top achievements
Rank 2
answered on 24 Jul 2013, 06:45 PM
I found if you force the BindTo to use a SelectList for the same data, it works.

Not sure if it's a bug though as the data is rendered in the HTML

.BindTo(new SelectList(Model.ClientList, "Key", "Value"))


Tags
DropDownList
Asked by
Ian
Top achievements
Rank 2
Answers by
Ian
Top achievements
Rank 2
Share this question
or