How to set the selected index property for a SelectList with strings? (ASP.NET MVC)

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-03-26T02:38:27Z Indexed on 2010/03/26 2:43 UTC
Read the original article Hit count: 192

Filed under:

I have the following code:

// Form the continuities list
        string[] continuities = new string[] { "10s", "20s", "30s" };
        Model.Continuities = new SelectList(continuities, 2 );

I expect "20s" to be selected

How can I do that without creating a new class?

© Stack Overflow or respective owner

Related posts about asp.net-mvc