This question is locked. New answers and comments are not allowed.
Hi,
I read an article in the Forum that combox UI doesn't care about the selected item and that it woukd be solved in the version 2010.3.1110.
Well we just implemented that version and I have a List wich returns an
I have a peace of code in my controller class wich fills this list and also sets the selected for one of the list items:
In my view I do an Ajax call to the controller. The data I get returned is the list with one item where 'selected=true'.
so the data returned seems to be ok.
Below how the data is bind to the combobox:
The dropdown is filled but the selected item is not selected.
It seems I am doing somthing wrong, I hope you can help me with it.
Regards,
Gerard Eikelboom
I read an article in the Forum that combox UI doesn't care about the selected item and that it woukd be solved in the version 2010.3.1110.
Well we just implemented that version and I have a List wich returns an
List<SelectListItem> list = new List<SelectListItem>();I have a peace of code in my controller class wich fills this list and also sets the selected for one of the list items:
foreach(var ws in UserWebshops) { if (ws.WebShop_ID == UserDefaultWebshop) { list.Add(new SelectListItem {Text= ws.Omschrijving, Value= ws.WebShop_ID.ToString(), Selected=true}); } else { list.Add(new SelectListItem { Text = ws.Omschrijving, Value = ws.WebShop_ID.ToString()}); } }In my view I do an Ajax call to the controller. The data I get returned is the list with one item where 'selected=true'.
so the data returned seems to be ok.
Below how the data is bind to the combobox:
success: function (data) { var comboBox = $("#UserDefaultWebshop").data("tComboBox"); comboBox.dataBind(data);The dropdown is filled but the selected item is not selected.
It seems I am doing somthing wrong, I hope you can help me with it.
Regards,
Gerard Eikelboom