Books/Edit.cshtml
|
@model BookStore1.Models.Book
@{ ViewData["Title"] = "Edit"; }
<h1>Edit</h1><h4>Book</h4><hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group">
<label asp-for="Title" class="control-label"></label>
<input asp-for="Title" class="form-control" />
<span asp-validation-for="Title" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Genre" class="control-label"></label>
<input asp-for="Genre" class="form-control" />
<span asp-validation-for="Genre" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Price" class="control-label"></label>
<input asp-for="Price" class="form-control" />
<span asp-validation-for="Price" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PublishDate" class="control-label"></label>
<input asp-for="PublishDate" class="form-control" />
<span asp-validation-for="PublishDate" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync( "_ValidationScriptsPartial"); }
}
|
await
await keyword is syntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece of code.
Html.RenderPartialAsync( "_ValidationScriptsPartial");
_ValidationScriptsPartial.cshtml file is typically located in the folder.
This file is a partial view and its purpose is to include the necessary JavaScript files for client-side validation using jQuery validation and jQuery Unobtrusive Validation.
|
“I doubt there’s a heaven; I think the people from hell have probably bought it for a timeshare.” — Victoria Wood |