DropDownListFor控件,提交问题?求解决
DropDownListFor(model.FristProblem,viewData["list"]as selectList,"-请选择-");在页面中选择值,点击提交,页面提示不存在FristProblem的ViewData。 MVC4 DropDownListFor --------------------编程问答-------------------- model里面有没有FristProblem呢。 --------------------编程问答-------------------- public class ProblemClass
{
[DisplayName("编号")]
public int Id { get; set; }
[DisplayName("关联名称")]
[ Required(ErrorMessage="*")]
public string UserName { get; set; }
[DisplayName("第一个问题:")]
[Required(ErrorMessage = "*")]
public string FristProblem { get; set; }
[DisplayName("第一个答案")]
[StringLength(50,ErrorMessage="More Word")]
[Required(ErrorMessage = "*")]
public string FristResult { get; set; }
[DisplayName("第二个问题:")]
[Required(ErrorMessage = "*")]
public string SecnedProblem { get; set; }
[DisplayName("第二个答案")]
[StringLength(50, ErrorMessage = "More Word")]
[Required(ErrorMessage = "*")]
public string SecnedResult { get; set; }
[DisplayName("第三个问题:")]
[Required(ErrorMessage = "*")]
public string ThirdProblem { get; set; }
[DisplayName("第三个答案")]
[StringLength(50, ErrorMessage = "More Word")]
[Required(ErrorMessage = "*")]
--------------------编程问答-------------------- public class ProblemClass
{
[DisplayName("编号")]
public int Id { get; set; }
[DisplayName("关联名称")]
[ Required(ErrorMessage="*")]
public string UserName { get; set; }
[DisplayName("第一个问题:")]
[Required(ErrorMessage = "*")]
public string FristProblem { get; set; }
[DisplayName("第一个答案")]
[StringLength(50,ErrorMessage="More Word")]
[Required(ErrorMessage = "*")]
public string FristResult { get; set; }
[DisplayName("第二个问题:")]
[Required(ErrorMessage = "*")]
public string SecnedProblem { get; set; }
[DisplayName("第二个答案")]
[StringLength(50, ErrorMessage = "More Word")]
[Required(ErrorMessage = "*")]
public string SecnedResult { get; set; }
[DisplayName("第三个问题:")]
[Required(ErrorMessage = "*")]
public string ThirdProblem { get; set; }
[DisplayName("第三个答案")]
[StringLength(50, ErrorMessage = "More Word")]
[Required(ErrorMessage = "*")]
补充:.NET技术 , ASP.NET