View
@model IList<DTO>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<div >
<table>
<thead>
<tr>
<th style="text-decoration: underline;cursor: pointer">Name</th>
<th style="text-decoration: underline;cursor: pointer">value</th>
</tr>
</thead>
<tbody>
@if (Model != null && Model.Count() > 0)
{
for (int i = 0; i < Model.Count;i++ )
{
<tr>
<td>@Html.TextBoxFor(m => m[i].Name)</td>
<td>@Html.TextBoxFor(m => m[i].Value)</td>
</tr>
}
}
</tbody>
<tr>
<td>
<input type="submit" value="Submit" class="redbutton"/>
</td>
</tr>
</table>
</div>
}
Controller
public ActionResult SystemParameters()
{
List<DTO> lstsysparam = new List<DTO>();
lstsysparam = _iAdminService.GetSystemParameteres();
return View(lstsysparam);
}
[HttpPost]
public ActionResult SystemParameters(List<SystemParametersDTO> lst)
{
// do operations on list.
}
@model IList<DTO>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<div >
<table>
<thead>
<tr>
<th style="text-decoration: underline;cursor: pointer">Name</th>
<th style="text-decoration: underline;cursor: pointer">value</th>
</tr>
</thead>
<tbody>
@if (Model != null && Model.Count() > 0)
{
for (int i = 0; i < Model.Count;i++ )
{
<tr>
<td>@Html.TextBoxFor(m => m[i].Name)</td>
<td>@Html.TextBoxFor(m => m[i].Value)</td>
</tr>
}
}
</tbody>
<tr>
<td>
<input type="submit" value="Submit" class="redbutton"/>
</td>
</tr>
</table>
</div>
}
Controller
public ActionResult SystemParameters()
{
List<DTO> lstsysparam = new List<DTO>();
lstsysparam = _iAdminService.GetSystemParameteres();
return View(lstsysparam);
}
[HttpPost]
public ActionResult SystemParameters(List<SystemParametersDTO> lst)
{
// do operations on list.
}
No comments:
Post a Comment