【发布时间】:2014-01-21 16:18:36
【问题描述】:
我有一个模型问题
public class Question
{
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int QuestionID { get; set; }
public int SystemAnswer { get; set; }
public int StudentAnswer { get; set; }
}
在我看来
@foreach (string[] item in ViewBag.Questions1 as List<string[]>)
{
<tr>
<td>
@Html.EditorFor(model => model.StudentAnswer)
@Html.ValidationMessageFor(model => model.StudentAnswer)
</td>
</tr>
}
ViewBag.Questions1 是 x 个字符串的列表
控制器
public ActionResult theAnswer(Question question)
{
int blah = question.StudentAnswer;
ViewBag.test = blah.ToString();
return View();
}
控制器应该将question.StudentAnswer int 值传递给另一个视图;但是,它只传递question.StudentAnswer 的第一个值。我怎样才能让它通过question.StudentAnswer??的所有值?
【问题讨论】:
-
这是一个
int。它只有一个值。
标签: c# asp.net-mvc