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

[Solved] DropDownList shows only the first element - but another one next to it works

1 Answer 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
dani
Top achievements
Rank 1
dani asked on 26 Jan 2011, 08:47 PM
This is very strange:

Controller:

myVM.OrderStatusList = ordersRepository.GetOrderStatuses().Select(x => new SelectListItem { Value = x.StatusID.ToString(), Text = x.StatusName, Selected = (x.StatusID == myVM.myOrder.StatusID) });
myVM.StoresList = ordersRepository.GetStoreList().Select(x => new SelectListItem { Value = x.StoreID.ToString(), Text = x.StoreName, Selected = (x.StoreID == myVM.myOrder.StoreID) });


View:
<%: Html.Label("Store: ") %>
 <%: Html.Telerik().DropDownListFor(x=>x.myOrder.StoreID)
     .BindTo(Model.StoresList)%>
 <%: Html.Label("Status: ") %>
 <%: Html.Telerik().DropDownListFor(x=>x.myOrder.StatusID)
     .BindTo(Model.OrderStatusList)%>
  </div>

Result in Store Dropdownlist wokring with 2 stores from DB.
Status Dropdownlist shows only the first out of 5 option, and doesn't open....

What can it be ?!
Dani

1 Answer, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 09 Feb 2011, 11:29 AM
It's got to be the data doesn't it? Are you sure theres more than one element for the status list?

Out of interest what happens if you switch the order they are rendered in?
Tags
ComboBox
Asked by
dani
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Share this question
or