开发者

dropdown question

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜