开发者

how can get previously selected value in dropdown list in edit page

I am using viewbag to put data in dropdownlist. In my edit page, I want to have selected value as the default value in my dropdown list. I am sending dropdownlist from the controller class a开发者_运维百科s follows:-

ViewBag.WareHouseId = new SelectList(db.WareHouse, "ID","Description");

my view code for dropdownlist is:-

@Html.DropDownList("WareHouseID","SELECT")

what should I add in the above line to show previously selected value before changing the value of drop downlist.?


Pass the model value to the optionLabel parameter:

@Html.DropDownList("WareHouseID", "SELECT", Model.WareHouseID)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜