asp.net mvc binding to listbox

Posted by ruben on Stack Overflow See other posts from Stack Overflow or by ruben
Published on 2010-06-02T10:30:50Z Indexed on 2010/06/02 10:33 UTC
Read the original article Hit count: 198

Filed under:
|

Hi im having trouble displaying data in a mcv website, i end up with selectlistitem displayed on the listbox as opposed to the id or value of the object that i am binding in my controller I do this

Authors = new SelectList(_authorRepository.GetAll(), "authorId", "Firstname",null),

and im my View

<%= Html.ListBox("AuthorsList", new SelectList(Model.Authors))%>

what else am I missing?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc