Get the text from Html.DropdownListFor…MVC3

前端 未结 4 745
被撕碎了的回忆
被撕碎了的回忆 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:34

    if what you want to do is to retrieve selected item then this can do the work :

      var selecteItem = model.DocumentTypes.Where(item=>item.Selected).FirstOrDefault();
    

    Cheers!

提交回复
热议问题