Hi @Kmcnet,
You did not provide the front-end code, so it is not clear how you post data,
you can refer to the following example.
@model List<MvcDemo612.Models.tbl_Log_Exams>
@{
ViewBag.Title = "ExamResults";
}
<h2>ExamResults</h2>
<form method="post" action="/Home/ExamResults">
<table class="table">
<thead>
<tr>
<th>
@Html.LabelFor(model => Model[0].ClientID)
</th>
<th>
@Html.LabelFor(model => Model[0].VisitID)
</th>
<th>
@Html.LabelFor(model => Model[0].MRNumber)
</th>
<th>
@Html.LabelFor(model => Model[0].TimeEntered)
</th>
<th>
@Html.LabelFor(model => Model[0].CategoryCode)
</th>
<th>
@Html.LabelFor(model => Model[0].Category)
</th>
<th>
@Html.LabelFor(model => Model[0].EnteredBy)
</th>
<th>
@Html.LabelFor(model => Model[0].Normal)
</th>
<th>
@Html.LabelFor(model => Model[0].Exceptions)
</th>
<th></th>
</tr>
</thead>
<tbody>
@for (var i = 0; i < Model.Count; i++)
{
<tr>
<td>
@Html.TextBoxFor(modelItem => Model[0].ClientID)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].VisitID)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].MRNumber)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].TimeEntered)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].CategoryCode)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].Category)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].EnteredBy)
</td>
<td>
@Html.TextBoxFor(modelItem => Model[0].Normal)
</td>
<td>
@Html.DisplayFor(modelItem => Model[0].Exceptions)
</td>
</tr>
}
</tbody>
</table>
<div>
<input type="submit" value="submit" />
</div>
</form>
public ActionResult ExamResults()
{
List<tbl_Log_Exams> list = List();
return View(list);
}
[HttpPost]
public ActionResult ExamResults(List<tbl_Log_Exams> model)
{
return Json(model);
}
private List<tbl_Log_Exams> List()
{
return new List<tbl_Log_Exams>() {
new tbl_Log_Exams()
{
ClientID = 1,
VisitID= 1,
MRNumber= "123",
TimeEntered=DateTime.Now,
CategoryCode= 1,
Category= "1",
EnteredBy= "1",
Normal= "All",
Exceptions= "None",
},
new tbl_Log_Exams()
{
ClientID = 2,
VisitID= 2,
MRNumber= "123",
TimeEntered=DateTime.Now,
CategoryCode= 1,
Category= "2",
EnteredBy= "2",
Normal= "All",
Exceptions= "",
}
};
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.