Note that there are some explanatory texts on larger screens.

plurals
  1. POSomebody explain me Html.DropDown and it's dearest friend SelectList
    text
    copied!<p>If you check my earlier questions you may have noticed I just don't get the SelectList and Html.DropDown(). I find it intrigueing that I seem to be the only one in this. So maybe I should try to change my mindset or maybe there are things I don't know that will clear this all up. I really love the whole MVC framework, but SelectList just doesn't want to fit in my head. So here's my list:</p> <p><strong>SelectList</strong></p> <ul> <li>Why can't I set the selected value after instantiation</li> <li>Why can't I set selectedValue by index of items</li> <li>Why is the selectedvalue sometimes a string, sometimes the class I put into it and sometimes a ListItem</li> <li>Why are the items only accesible through GetItems()</li> <li>Why don't the types of selectedItem and the listItems match?</li> <li>Why are the items you put in the list converted to listItem and the selectedItem not?</li> <li>Why can't I get the count of the items without usint the GetItems() method</li> </ul> <p><strong>Html.DropDownList()</strong></p> <ul> <li>Why doesn't modelbinding work with it</li> <li>Why is there no behaviour for defaulting selection when there's only one option </li> <li>Why doesn't making an item SelectedValue in the source selectLIst make it the marked item</li> </ul> <p>Before ppl suggest me to write my own:<br> Since this will be shipped with the MVC product, I would rather have the offical support for a basic controll then to roll my own and have all the troubles that come with it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload