Advertisement
ingomarmurcia

Form.cshtml - Estudiantes

Mar 21st, 2020
3,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 2.85 KB | None | 0 0
  1. @model ADSProjectLab.Models.Estudiante
  2.  
  3. @{
  4.     ViewBag.Title = "Mantenimiento de Estudiante";
  5.     Layout = "~/Views/Shared/_Layout.cshtml";
  6. }
  7.  
  8. <h2>Estudiante</h2>
  9.  
  10.  
  11. @using (Html.BeginForm())
  12. {
  13.     @Html.AntiForgeryToken()
  14.     <input type="hidden" id="_operacion" value="@ViewData["Operacion"]" />
  15.     <div class="form-horizontal">
  16.         <hr />
  17.         @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  18.         @Html.HiddenFor(model => model.Id)
  19.  
  20.         <div class="form-group">
  21.             @Html.LabelFor(model => model.Codigo, htmlAttributes: new { @class = "control-label col-md-2" })
  22.             <div class="col-md-10">
  23.                 @Html.EditorFor(model => model.Codigo, new { htmlAttributes = new { @class = "form-control" } })
  24.                 @Html.ValidationMessageFor(model => model.Codigo, "", new { @class = "text-danger" })
  25.             </div>
  26.         </div>
  27.  
  28.         <div class="form-group">
  29.             @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
  30.             <div class="col-md-10">
  31.                 @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
  32.                 @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
  33.             </div>
  34.         </div>
  35.  
  36.         <div class="form-group">
  37.             @Html.LabelFor(model => model.Nombres, htmlAttributes: new { @class = "control-label col-md-2" })
  38.             <div class="col-md-10">
  39.                 @Html.EditorFor(model => model.Nombres, new { htmlAttributes = new { @class = "form-control" } })
  40.                 @Html.ValidationMessageFor(model => model.Nombres, "", new { @class = "text-danger" })
  41.             </div>
  42.         </div>
  43.  
  44.         <div class="form-group">
  45.             @Html.LabelFor(model => model.Apellidos, htmlAttributes: new { @class = "control-label col-md-2" })
  46.             <div class="col-md-10">
  47.                 @Html.EditorFor(model => model.Apellidos, new { htmlAttributes = new { @class = "form-control" } })
  48.                 @Html.ValidationMessageFor(model => model.Apellidos, "", new { @class = "text-danger" })
  49.             </div>
  50.         </div>
  51.  
  52.         <div class="form-group">
  53.             <div class="col-md-offset-2 col-md-10">
  54.                 <input type="submit" value="Guardar" class="btn btn-default" />
  55.             </div>
  56.         </div>
  57.     </div>
  58. }
  59.  
  60. <div>
  61.     @Html.ActionLink("Regresar", "Index")
  62. </div>
  63.  
  64. @section Scripts {
  65.     @Scripts.Render("~/bundles/jqueryval")
  66.     <script>
  67.  
  68.         $(document).ready(function () {
  69.             // Cuando la operación es Ver, entonces se deben desabilitar los controles del formulario.
  70.             if ($("#_operacion").val() == "Ver") {
  71.                 $("form").find("input, select").attr("disabled", true);
  72.             }
  73.         });
  74.  
  75.     </script>
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement