Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model ADSProjectLab.Models.Estudiante
- @{
- ViewBag.Title = "Mantenimiento de Estudiante";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <h2>Estudiante</h2>
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- <input type="hidden" id="_operacion" value="@ViewData["Operacion"]" />
- <input type="hidden" id="_redirectURL" value='@Url.Action("Index", "Estudiantes")' />
- <div class="form-horizontal">
- <hr />
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- @Html.HiddenFor(model => model.Id)
- <div class="form-group">
- @Html.LabelFor(model => model.Codigo, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.Codigo, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.Codigo, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.Nombres, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.Nombres, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.Nombres, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.Apellidos, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.Apellidos, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.Apellidos, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.IdCarrera, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.DropDownListFor(
- model => model.IdCarrera,
- new SelectList(ViewBag.Carreras, "Id", "Nombre"),
- "[Selecciones una opción]",
- htmlAttributes: new { @class = "form-control" })
- @Html.ValidationMessageFor(model => model.IdCarrera, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <input type="submit" value="Guardar" class="btn btn-default" />
- </div>
- </div>
- </div>
- }
- <div>
- @Html.ActionLink("Regresar", "Index", new { }, new { @class = "btn btn-default btn-sm" })
- </div>
- @section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
- <script>
- $(document).ready(function () {
- // Cuando la operación es Ver, entonces se deben desabilitar los controles del formulario.
- if ($("#_operacion").val() == "Ver") {
- $("form").find("input, select").attr("disabled", true);
- }
- //Agregamos a los formularios la clase form-ajax
- //La cual activa el formulario para trabajar con Ajax
- $("form").addClass("form-ajax");
- //Activamos Ajax
- initAjaxForm();
- });
- </script>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement