这是一个概念问题。
据我所知,MVC 具有无状态的性质。当我在浏览器中点击重新加载 (F5) 时,我在视图中写入或更改的值不会消失,也不会被模型中的原始值替换。
有谁知道为什么会这样?我假设在我重新加载页面的那一刻,修改后的“未提交”值应该消失。
我的观点只是剃须刀代码......我不使用网络表单(我的意思是,我的应用程序中没有 .aspx 页面)
@model PruebaMVC.Models.DatosLINQ.OPERACION
@{
ViewBag.Title = "Edit";
}
<h2>Editar Operación</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Operación</legend>
@Html.HiddenFor(model => model.IDOperacion)
<div class="editor-label">
@Html.LabelFor(model => model.FechaOperacion, "Fecha de la Operación")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.FechaOperacion)
@Html.ValidationMessageFor(model => model.FechaOperacion)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Comision, "Comisión")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Comision)
@Html.ValidationMessageFor(model => model.Comision)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Legajo, "Número de Legajo")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Legajo)
@Html.ValidationMessageFor(model => model.Legajo)
</div>
<p>
<input type="submit" class="formbutton" value="Guardar Cambios" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Volver al listado de Operaciones", "Index")
</div>
我希望不要通过提出概念性问题来影响网站的任何规则。如果我是,请告诉我,这样我就不会再这样做了。