首页 > 解决方案 > ASP.Net MVC 5 Html.DropDownListFor - 模型始终是 nu

问题描述

在我的模型中,我定义了以下内容:

公共字符串程序 {get;set;}

公共 IEnumerable ProgramList...

在我看来,我有:

@Html.DropDownListFor(model => model.Program, Model.ProgramList);

我的问题是,在视图中,模型始终为 NULL。在我看到的示例中,DropDownListFor 的第二个参数是硬编码值或枚举。

我正在尝试的可能吗?

为什么模型总是空的?

谢谢

标签: asp.net-mvchtml.dropdownlistfor

解决方案


推荐阅读