ASP.NETMVC:为什么我的视图将空模型传递回我的控制器?
@model Non_P21_Quote_System_v1._0.Models.gl_code@{ ViewBag.Title = "Edit"; Layout = "~/Views/Shared/_Layout.cshtml";}<h2>Edit</h2>@if (TempData["Message"] != null){ <div style="color:green"> @TempData["Message"] </div><br />}@if (ViewBag.error != null){ <div style="color:red"> <h3>@ViewBag.error</h3> </div><br />}@using (Html.BeginForm()){ @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>gl_code</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) <div class="form-group"> @Html.LabelFor(model => model.GL_code, "GL Code", htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.GL_code, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.GL_code, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.GL_description, "Gl Description", htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.GL_description, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.GL_description, "", new { @class = "text-danger" }) </div> </div>
qq_花开花谢_0
慕莱坞森