更新时间:2023-02-01 10:27:17
这是什么Romias上述延伸,在你的控制器,设置Model.State任何你想要的值。如果你想WI,然后Model.State应该等于这一点。
Extending on what Romias said, in your controller, set Model.State to whatever value you want. If you wanted 'WI', then Model.State should equal that.
控制器
public ActionResult Index()
{
var m = new TestViewModel();
m.State = "WI";
return View(m);
}
查看
@Html.DropDownListFor(m => m.State, new SelectList(Model.StateList, "Value", "Text", Model.State))