Can anyone please tell me how to post these values from view to controller and there by from controller to database by creating objects:
@model task.tabPerson1
@{
ViewBag.Title = "Edit";
}
Edit
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
tabPerson1
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.personId)
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DisplayFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.mobileNo, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.mobileNo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.mobileNo, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.HowManyAddress, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.HowManyAddress, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.HowManyAddress, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.sequenceNo, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.sequenceNo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.sequenceNo, "", new { @class = "text-danger" })
}
@foreach (var item in Model.tabAddress1)
{
| Person Id | : | |||||||||||||
| address Id | : | |||||||||||||
| country | : | |||||||||||||
| city | : | |||||||||||||
| Addresses | : |
}
@Html.ActionLink("Back to List", "getPersonDetails")
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Salman BegPosted Oct 14, 2016, 3:19 AM