DropDownListFor does not set selected value

前端 未结 2 352
渐次进展
渐次进展 2021-01-21 18:06

I have a view that is displaying a Drop down list using the HTML helper DropDownListFor

<%: Html.DropDownListFor(Function(model) model.Manufacturer, New Selec         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-21 18:46

    I've done a similar quick-fix in JQuery today to fix this behaviour too :

    $(document).ready(function() {
    $(".wrapper<%: Model.Language %> option[value=<%: Model.Language %>]").attr("selected","true");
    });
    

    Though I could share it with others if needed.

    I'd still like to see a real patch to this problem so many persons seems to have in a different way, maybe with an extension method of the already existing DropDownListFor Html.helper method.

提交回复
热议问题