Get the text from Html.DropdownListFor…MVC3

前端 未结 4 739
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 18:57

I have a model:

public class DocumentModel
{
    public int TypeID { get; set; }
    public List DocumentTypes { get; set; }
}
4条回答
  •  孤城傲影
    2021-02-04 19:37

    I stumbled here trying to find the way to get the text value out of a SelectList to display it in a format other than a DropDownList (I'm reusing my Edit ViewModel as it has all the data I required)

    var text = selectList.Where(q => q.Selected == true).First().Text;
    

提交回复
热议问题