MVC5 - How to set “selectedValue” in DropDownListFor Html helper

前端 未结 3 2053
青春惊慌失措
青春惊慌失措 2020-11-22 05:18

As the question says: How to set selectedValue in DropDownListFor Html helper?

Tried most of the other solutions but none worked that\'s why I am opening a new quest

3条回答
  •  既然无缘
    2020-11-22 05:20

    Make Sure that your return Selection Value is a String and not and int when you declare it in your model.

    Example:

    public class MyModel
    {
        public string TipPopustaId { get; set; }
    }
    

提交回复
热议问题