Can anyone give me an example of saving all html grid data in one time. I have a view like this.
@model IList<SURVEY.Models.Question>
@using (Html.BeginForm("Index", "Survey", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-3" }))
{
@foreach(var item in Model)
{
<tr>
<td>@item.Ans1</td>
<td align="center">
<label>
<input type="radio" name="optionAS_@item.QuestionId" value="1" id="optionAS_1" onclick="disableAs(this,@item.QuestionId,1)"/>
</label>
</td>
<td align="center">
<label>
<input type="radio" name="optionAS_@item.QuestionId" value="2" id="optionAS_1" onclick="disableAs(this,@item.QuestionId,2)"/>
</label>
</td>
</tr>
}
}
I am getting null value for these controls in controller post.
[HttpPost]
public ActionResult Index(IList<Question> ques)
{
return View();
}
I am getting ques
is null
here. Can anyone tell me how can I resolve this?