How can i get this ASP.NET MVC SelectList to work?

Posted by Pure.Krome on Stack Overflow See other posts from Stack Overflow or by Pure.Krome
Published on 2009-04-23T14:23:20Z Indexed on 2010/03/17 1:31 UTC
Read the original article Hit count: 381

Filed under:
|
|

Hi folks, I create a selectList in my controller, to display in the view.

I'm trying to create it on the fly, sorta thing .. like this...

myViewData.PageOptionsDropDown = 
   new SelectList(new [] {"10", "15", "25", "50", "100", "1000"}, "15");

It compiles, but the output is bad...

<select id="PageOptionsDropDown" name="PageOptionsDropDown">
    <option>10</option>
    <option>15</option>
    <option>25</option>
    <option>50</option>
    <option>100</option>
    <option>1000</option>
</select>

Notice how no item is selected?

How can i fix this??

Update

Just bumping this ... issue still outstanding :(

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc