Skip to content

Instantly share code, notes, and snippets.

@evan-boissonnot
Created February 20, 2019 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evan-boissonnot/8b6073dfbc2b87295a341bae229641af to your computer and use it in GitHub Desktop.
Save evan-boissonnot/8b6073dfbc2b87295a341bae229641af to your computer and use it in GitHub Desktop.
Remote jqueryval
@model TestAspNetMvcNet.Models.Livre
@{
ViewBag.Title = "Create";
List<SelectListItem> list = new List<SelectListItem>()
{
new SelectListItem() { Text = "Pisto 1", Value = "1" },
new SelectListItem() { Text = "Pisto 2", Value = "2" }
};
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Livre</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Prix, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Prix, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Prix, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.PistoLaser, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.PistoLaser, list)
@Html.ValidationMessageFor(model => model.PistoLaser, "", 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")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment