Necesito hacer este select
:
<select class="form-control">
<option>ESPOSO(A)</option>
<option>HIJO(A)</option>
<option>CONYUGUE</option>
<option>ACUDIENTE</option>
</select>
Pero no sé cómo hacerlo en Razor, estuve mirando unas publicaciones y artículos pero solo muestra como cargarlos dinámicamente con datos de la base de datos, y yo solo necesito esos datos estáticos, pero no doy cómo.
Mi Controller
:
// GET: Families/Create
public ActionResult Create()
{
return View();
}
Mi View
:
@model OldMutual.Models.Families
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Families</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.documento_identidad, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.documento_identidad, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.documento_identidad, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.parentesco, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.parentesco, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.parentesco, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.names, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.names, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.names, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.fecha_nacimiento, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.fecha_nacimiento, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.fecha_nacimiento, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.sexo, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.sexo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.sexo, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.celular, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.celular, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.celular, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.telefono, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.telefono, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.telefono, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.codigo_colaborador, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.codigo_colaborador, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.codigo_colaborador, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
Cabe aclarar que el select
es para el model.parentesco
.
<div class="form-group">
@Html.LabelFor(model => model.parentesco, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.parentesco, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.parentesco, "", new { @class = "text-danger" })
</div>
</div>