开发者

dropdown question

开发者 https://www.devze.com 2022-12-19 01:17 出处:网络
What is wrong with this ? <%=Html.DropDownListFor(m=>m.Client,null,\"Select\",new { @style = \"width: 630px\" })%>

What is wrong with this ?

<%=Html.DropDownListFor(m=>m.Client,null,"Select",new { @style = "width: 630px" })%>

There is a ViewData["Client"] which contanins the source , the dropdown is filled but is not selected the value corresponding to Model.Clie开发者_如何学Pythonnt


Change ViewDate["Client"] to ViewData["ClientList"] and put it instead of null .Dont forget to cast it to SelectList.

<%=Html.DropDownListFor(m=>m.ClientId,(SelectList)ViewData["ClientList"],"Select",new { @style = "width: 630px" })%>

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消