【发布时间】:2023-03-03 12:28:01
【问题描述】:
这是我的视图模型
public class IndexViewModel
{
public string QuestionText { get; set; }
public string Sname { get; set; }
public string Cname { get; set; }
public int CID { get; set; }
public int SID { get; set; }
public Question question { get; set; }
public CoreValue corevalue { get; set; }
public SubjectType subjecttype { get; set; }
}
在我看来,这段代码无法正常工作:
@model NKI3.ViewModels.IndexViewModel
@using (Html.BeginForm()) {
<fieldset>
<div class="editor-label">
@Html.DropDownListFor(model => model.Sname)
</div>
</fieldset>
}
我收到的错误消息是“方法 'DropDownListFor 没有重载需要 1 个参数”
解决办法是什么?
谢谢!
【问题讨论】:
标签: model-view-controller drop-down-menu viewmodel