Controller Code
- public ActionResult EditState(int id)
- {
- StateModel sm = new StateModel();
- var state = sm.EditState(id);
- if (state != null)
- { return Json(state, JsonRequestBehavior.AllowGet); }
- else
- {
- return null;
- }
- //return View();
- }
View Code
- @model VizioCRM.Models.State
- @{
- ViewBag.Title = "EditState";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
EditState
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- class="form-horizontal">
State
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- @Html.HiddenFor(model => model.StateID)
class="form-group">- @Html.LabelFor(model => model.StateName, htmlAttributes: new { @class = "control-label col-md-2" })
class="col-md-10">- @Html.EditorFor(model => model.StateName, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.StateName, "", new { @class = "text-danger" })
class="form-group">class="col-md-offset-2 col-md-10">- "submit" value="Save" class="btn btn-default" />
- }
- @Html.ActionLink("Back to List", "Index")
Jignesh KumarPosted Aug 8, 2018, 8:59 AM