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")
Salman BegRank #284 · 8.8K reputationPosted Oct 13, 2016, 11:19 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts