I have the following Index view:
#model IEnumerable<MVCMovie3.Models.Movie>
#{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<form asp-controller="Movies" asp-action="Index">
<p>
Title: <input type="text" name="SearchString">
<input type="submit" value="Filter" />
</p>
</form>
<table class="table">
<tr>
<th>
#Html.DisplayNameFor(model => model.Title)
</th>
<th>
#Html.DisplayNameFor(model => model.Genre)
</th>
<th>
#Html.DisplayNameFor(model => model.ReleaseDate)
</th>
<th>
#Html.DisplayNameFor(model => model.Rating)
</th>
<th>
#Html.DisplayNameFor(model => model.Price)
</th>
<th></th>
</tr>
#foreach (var item in Model) {
<tr>
<td>
#Html.DisplayFor(modelItem => item.Title)
</td>
<td>
#Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
#Html.DisplayFor(modelItem => item.ReleaseDate)
</td>
<td>
#Html.DisplayFor(modelItem => item.Rating)
</td>
<td>
#Html.DisplayFor(modelItem => item.Price)
</td>
<td>
<a asp-action="Edit" asp-route-id="#item.ID">Edit</a> |
<a asp-action="Details" asp-route-id="#item.ID">Details</a> |
<a asp-action="Delete" asp-route-id="#item.ID">Delete</a>
</td>
</tr>
}
</table>
And here is the "Edit" view listed in the Index view:
#model MVCMovie3.Models.Movie
#{
ViewData["Title"] = "Edit";
}
<h2>Edit</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>Movie</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="ID" />
<div class="form-group">
<label asp-for="Genre" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Genre" class="form-control" />
<span asp-validation-for="Genre" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Price" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Price" class="form-control" />
<span asp-validation-for="Price" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Rating" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Rating" class="form-control" />
<span asp-validation-for="Rating" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="ReleaseDate" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ReleaseDate" class="form-control" />
<span asp-validation-for="ReleaseDate" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Title" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Title" class="form-control" />
<span asp-validation-for="Title" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
</form>
<div>
<a asp-action="Index">Back to List</a>
</div>
#section Scripts {
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
My problem is that everything shows fine on the Index view but when I click the link to bring up the Edit view the release date is gone. Any suggestions?
Also, here is my model that I generated the views off of:
using System;
using System.ComponentModel.DataAnnotations;
namespace MVCMovie3.Models
{
public class Movie
{
public int ID { get; set; }
public string Title { get; set; }
public string Genre { get; set; }
public string Rating { get; set; }
public decimal Price { get; set; }
[Display(Name = "ReleaseDate")]
[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }
}
}
In playing around with it I've found that if I take off the [Display(Name.... and [DisplayType.... parts then it runs fine, except now my release date is not in the format I want it to be in. Help please.....
For now the only fix that i have found is to change the following code:
[Display(Name = "Release Date")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime ReleaseDate { get; set; }
To:
[Display(Name = "Release Date")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}")]
public DateTime ReleaseDate { get; set; }
This is, to remove the ApplyFormatInEditMode = true from the DisplayFormat line.
No the less as i mentioned before this would make the DatePicker field to show a date format in the form dd-MM-yyyy (the default one) and not the one you selected.
Related
Im trying to submit a form that consist of checkboxes.
When I submit the form I don't get the selected data from the form. I have been trying to use asp-for but I don't understand what I'm doing wrong.
this is my razor page:
#model TheaterReservering.Models.KlantReservering
#{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Reservering voor: #Model.Klant.Naam</h4>
<form asp-action="Edit">
<input type="hidden" asp-for="Klant" />
<table class="table">
<thead>
<tr>
<th>
1
</th>
<th>
2
</th>
<th>
3
</th>
<th>
4
</th>
<th>
5
</th>
<th>
6
</th>
<th></th>
</tr>
</thead>
<tbody>
#{
var count = 0;
}
#foreach (var item in Model.Reserveringen)
{
if ((count % 6) == 0)
{
#:<tr>
}
<td style="text-align:center; vertical-align:middle">
<div class="form-group">
#if (item.KlantId == Model.Klant.Id)
{
<input type="checkbox" asp-for="Reserveringen.ElementAt(count).Bezet" checked />
<br />
<div style="background-color: blue; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
else if (item.KlantId == null)
{
<input type="checkbox" asp-for="Reserveringen.ElementAt(count).Bezet" />
<br />
<div style="background-color: green; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
else
{
<input type="checkbox" checked disabled />
<br />
<div style=" background-color: red; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
</div>
</td>
if ((count % 6) == 5)
{
#:</tr>
}
count++;
}
</tbody>
</table>
<div class="form-group">
<input type="submit" value="Reserveringen vastleggen" class="btn btn-primary" />
</div>
</form>
My controller methode:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Klant,Reserveringen")] KlantReservering klantReservering)
{
if (id != klantReservering.Klant.Id)
{
return NotFound();
}
if (ModelState.IsValid)
{
_context.Update(klantReservering);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(klantReservering);
}
and this is the class i created to combine the class Klant with Reservering.
public class KlantReservering
{
public Klant Klant { get; set; }
public List<Reservering> Reserveringen { get; set; }
}
}
As far as I know, the tag helper couldn't work with a model class, it could only work for the model's property.
That means we couldn't use tag helper like this <input type="hidden" asp-for="Klant" />. If we want to achieve model binding in the controller method. I suggest you could add all the property as below:
<input type="hidden" asp-for="#Model.Klant.Id" />
<input type="hidden" asp-for="#Model.Klant.Naam" />
Besides, for the foreach item, tag helper couldn't figure out what the "Reserveringen.ElementAt(count).Bezet" means, we could only use this "#Model.Reserveringen[count].Bezet".
More details, you could refer to below example view:
Notice: Since I don't know your details codes about the Klant and the Reserveringen class, I created a test class in my side which just contains Naam and Id property.
#model CoreNormalIssue.Models.KlantReservering
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
#*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*#
#{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Reservering voor: #Model.Klant.Naam</h4>
<form asp-controller="Verify" asp-action="Edit" method="post" asp-route-id="#Model.Klant.Id">
<input type="hidden" asp-for="#Model.Klant.Id" />
<input type="hidden" asp-for="#Model.Klant.Naam" />
<table class="table">
<thead>
<tr>
<th>
1
</th>
<th>
2
</th>
<th>
3
</th>
<th>
4
</th>
<th>
5
</th>
<th>
6
</th>
<th></th>
</tr>
</thead>
<tbody>
#{
var count = 0;
}
#foreach (var item in Model.Reserveringen)
{
<input type="text" asp-for="#item.Bezet" />
if ((count % 6) == 0)
{
#:<tr>
}
<td style="text-align:center; vertical-align:middle">
<div class="form-group">
#if (item.KlantId == Model.Klant.Id)
{
<input type="checkbox" asp-for="#Model.Reserveringen[count].Bezet" checked />
<br />
<div style="background-color: blue; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
else if (item.KlantId == null)
{
<input type="checkbox" asp-for="#Model.Reserveringen[count].Bezet" />
<br />
<div style="background-color: green; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
else
{
<input type="checkbox" checked disabled />
<br />
<div style=" background-color: red; text-align: center">
<label style="color:white" asp-for="#item.Naam">#item.Naam</label>
</div>
}
</div>
</td>
if ((count % 6) == 5)
{
#:</tr>
}
count++;
}
</tbody>
</table>
<div class="form-group">
<input type="submit" value="Reserveringen vastleggen" class="btn btn-primary" />
</div>
</form>
Result:
I want to implement client side validation on my form, but none of the required error message is showing when I not putting data.
Scripts are loaded correctly in the layout file.
And in the rest of the views, Required messages are displayed correctly and the program works correctly .
I've sent the codes for this subject to the attachment.
controller:
<HttpPost()>
Function GalleryFiles1(ByVal docs As MachininfoDocs, ByVal imgUp As HttpPostedFileBase) As ActionResult
If ModelState.IsValid Then
If imgUp IsNot Nothing And IsImage(imgUp) Then
docs.FileName = Guid.NewGuid().ToString() & Path.GetExtension(imgUp.FileName)
docs.DocGroup = 1
docs.MachininfoID = PVMachinInfoId
imgUp.SaveAs(Server.MapPath("/Images/MachinImages/" & docs.FileName))
Dim img As New ImageResizer()
img.Resize(Server.MapPath("/Images/MachinImages/" & docs.FileName), Server.MapPath("/Images/MachinImages/Thumb/" & docs.FileName))
db.MachininfoDocs.Add(docs)
db.SaveChanges()
End If
End If
Return RedirectToAction("GalleryFiles1", New With {Key .id = docs.MachininfoID})
End Function
View:
#ModelType Machinary.MachininfoDocs
#Code
ViewData("Title") = "اسناد مالکیت"
Layout = "~/Views/Shared/_Layout.vbhtml"
End Code
#Using (Html.BeginForm("GalleryFiles1", "Machininfo", FormMethod.Post, New With {.enctype = "multipart/form-data"}))
#Html.AntiForgeryToken()
#Html.HiddenFor(Function(model) model.MachininfoID)
#<div Class="panel">
<header Class="panel-heading tab-bg-dark-navy-blue">
<Label Class="bg-transparent wht-color"> اطلاعات جامع ماشین آلات- اسناد مالکیت</Label>
</header>
<br />
<div Class="form-horizontal panel-body">
<div class="col-md-4">
#Html.ValidationSummary(True, "", New With {.class = "text-danger"})
<div class="form-group">
#Html.LabelFor(Function(model) model.Title, htmlAttributes:=New With {.class = "control-label col-md-2"})
<div class="col-md-10">
#Html.EditorFor(Function(model) model.Title, New With {.htmlAttributes = New With {.class = "form-control"}})
#Html.ValidationMessageFor(Function(model) model.Title, "", New With {.class = "text-danger"})
</div>
</div>
<div class="form-group">
#Html.LabelFor(Function(model) model.FileName, htmlAttributes:=New With {.class = "control-label col-md-2"})
<div class="col-md-10">
<input type="file" name="imgUp" class="form-control-file" />
#Html.ValidationMessageFor(Function(model) model.FileName, "", New With {.class = "text-danger"})
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="ثبت" class="btn btn-success" />
</div>
</div>
<br />
</div>
<div class="col-md-8">
#code
Dim al As List(Of MachininfoDocs) = ViewBag.Docs
End code
<Table Class="table table-bordered table-responsive-sm">
<tr>
<th class="col-md-3"> تصویر</th>
<th class="col-md-7"> عنوان</th>
<th>
</th>
</tr>
#For Each item In al
#<tr id="tbrow_#(item.Id)">
<td>
<img style="width:100% ; height:120px" src="~/Images/MachinImages/Thumb/#item.FileName" class=" img-thumbnail" />
</td>
<td>
#item.Title
</td>
<td>
<a class="btn btn-sm btn-danger" onclick="DeleteTbRow(#item.Id)">
<i class="glyphicon glyphicon-trash btn btn-danger btn-sm"></i>
</a>
</td>
</tr>
Next
</Table>
</div>
</div>
</div>
End Using
<div class="pull-left btn btn-default">
#Html.ActionLink("برگشت به لیست", "Index")
</div>
#section MyScripts
<script>
function DeleteTbRow(id) {
if (confirm('آیا از حذف مطمئن هستید ؟')) {
$.get("/Machininfo/DeleteGallery/" + id,
function () {
$("#tbrow_" + id).hide('slow');
});
}
}
</script>
End Section
MetaData class:
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Friend Class MachininfoDocsMetaData
<ScaffoldColumn(False)>
<Bindable(False)>
Public Property Id As Integer
Public Property MachininfoID As Integer
Public Property DocGroup As Integer
<Required(AllowEmptyStrings:=False, ErrorMessage:="لطفاً {0} را به درستی درج نمائید")>
<DisplayName("عنوان")>
<Display(Name:="عنوان")>
<StringLength(200, ErrorMessage:="مقدار {0} نباید بیش از 200 کاراکتر باشد")>
Public Property Title As String
<DisplayName("انتخاب فایل")>
<Display(Name:="انتخاب فایل")>
Public Property FileName As String
End Class
<MetadataType(GetType(MachininfoDocsMetaData))>
Partial Public Class MachininfoDocs
End Class
One common mistake is for who use mvc default bundles forget to import the bundle in the layout
#Scripts.Render("~/bundles/jqueryval")
Also you should activate them in the web.config appsettings
<appSettings>
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="ValidationSettings:UnobtrusiveValidationMode" value="none" />
This question already has answers here:
Post an HTML Table to ADO.NET DataTable
(2 answers)
Closed 4 years ago.
I have a object that I am binding to my view. This object has a list of items with a boolean field on them. I use this boolean field to bind to a checkbox on the form. I am wanting the user to select the items they want and then submit. This issue is, when it is submitted and passed to the post action, the list of items is null.
Here is the View Model passed into the view.
public class ReAssignVM
{
public string ToUsername { get; set; }
public string FromUsername { get; set; }
public IEnumerable<ReAssignTaskVM> Tasks { get; set; }
} // End of Class
Here is the view:
#model SRM.ClassLibrary.V1.ViewModels.TaskViewModels.ReAssignVM
#{
ViewData["Title"] = "Re-Assign Tasks";
}
<h2>Re-Assign Tasks</h2>
<br />
<div class="row">
<div class="col-md-1 alignRight">
<b>From:</b>
</div>
<div class="col-md-3">
#Model.FromUsername
</div>
<div class="col-md-1 alignRight">
<b>To:</b>
</div>
<div class="col-md-3">
#Model.ToUsername
</div>
</div>
<br />
<form asp-action="ReAssignTasks">
<input type="hidden" asp-for="FromUsername" />
<input type="hidden" asp-for="ToUsername" />
<div include-if="#Model.Tasks != null && Model.Tasks.Count() > 0">
<table class="table table-hover">
<thead class="thead-light">
<tr>
<th></th>
<th>
Status
</th>
<th>
Date
</th>
<th>
Student
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
#foreach (var task in Model.Tasks.OrderBy(n => n.TaskDate))
{
<tr>
<td>
#Html.HiddenFor(item => task.TaskID)
#Html.CheckBoxFor(item => task.Assign)
</td>
<td>
#Html.DisplayFor(item => task.TaskStatus)
</td>
<td>
#task.TaskDate.ToLocalTime().ToString("M/d/yyyy")
</td>
<td>
#Html.DisplayFor(item => task.StudentUsername)
</td>
<td>
#Html.DisplayFor(item => task.Description)
</td>
</tr>
}
</tbody>
</table>
<br />
<div class="row">
<div class="col-md-12 alignRight">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#assignment">
Re-Assign
</button>
</div>
</div>
</div>
<div class="modal fade" id="assignment" tabindex="-1" role="dialog" aria-labelledby="assignmentLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="assignmentLabel">Confirm Re-Assignment of Tasks?</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Selected tasks will be re-assigned from #Model.FromUsername to #Model.ToUsername</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<input type="submit" value="Confirm" class="btn btn-primary" />
</div>
</div>
</div>
</div>
</form>
<div exclude-if="#Model.Tasks != null && Model.Tasks.Count() > 0">
<div class="alert alert-info">
There are no tasks to re-assign.
</div>
</div>
Can someone help me understand how to do this correctly?
You will need to provide the indexing to your Collection items to posted back in the model as Model binder would use those to bind back the objects to action. So you should be using For loop and IList<T> as your model in view :
#for(int i=0; i< Model.Tasks.Count(); i++)
{
#Html.HiddenFor(item => Model.Tasks[i].TaskID)
#Html.CheckBoxFor(item => Model.Tasks[i].Assign)
............
............
}
and in your model change it to be IList<T> as you wouldn't have indexer on IEnumerable<T>:
public class ReAssignVM
{
public string ToUsername { get; set; }
public string FromUsername { get; set; }
public IList<ReAssignTaskVM> Tasks { get; set; }
} // End of Class
below is the code in my View
#using ClaimBuildMVC.Models
#model IEnumerable<Asset>
#{
ViewBag.Title = "AssetsPage";
Layout = "~/Views/Shared/_SuperAdminLayout.cshtml";
}
<script type="text/javascript">
</script>
#using (Html.BeginForm("AssetsPage", "SuperAdmin", FormMethod.Post,new{enctype = "multipart/form-data"}))
{
<div class="Content-inner-pages">
<div class="TopHeading TopHeading2">
<h2>Assets</h2>
<a class="CreateBtn AssetsBtn" href="Javascript:void(0);" onclick="javascript:$('#hdnIsNew').val('1')">Add Asset</a>
<div class="clearfix"></div>
</div>
<input type="hidden" id="hdnIsNew" value="1" />
<input type="hidden" id="hdnRecId" />
<!-- Slide Popup panel -->
<div class="cd-panel from-right AddAssetForm">
<header class="cd-panel-header">
<h3>Add Asset</h3>
Close
</header>
<div class="cd-panel-container">
<div class="cd-panel-content">
<div class="form-horizontal form-details popup-box">
<div class="form-group">
<label class="col-md-5 control-label">
Asset Title
</label>
<div class="col-md-7">
<input type="text" id="txtTitle" name="txtTitle" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-5 control-label">Description</label>
<div class="col-md-7">
<textarea id="txtDesc" class="form-control" cols="5" rows="5"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-5 control-label">Attachment</label>
<div class="col-md-7">
<input type="file" id="file" class="custom-file-input">
</div>
</div>
<div class="form-group">
<div class="col-md-7 col-md-offset-5">
<input type="submit" value="Save" name="actionType" class="btn-class btn-success">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-content Custom-DataTable">
<table id="AdministationAssets" class="table table-hover dt-responsive CustomDatable AdministationAssetsTable" cellspacing="0" width="100%">
<thead>
<tr>
<th style="width:5%;">Assets</th>
<th style="width:15%;">
#Html.DisplayNameFor(model =>model.Title)
</th>
<th style="width:50%;">
#Html.DisplayNameFor(model =>model.Description)
</th>
<th style="width:8%;">Options</th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td></td>
<td>
#Html.DisplayFor(modelItem => item.Title)
</td>
<td>
#Html.DisplayFor(modelItem =>item.Description)
</td>
<td>
#Html.ActionLink("Edit", "AddEditRecord", new{ id = item.ID }, new { #class = "ActionEdit AssetEdit", onclick ="javascript:GetEditDetails(" + item.ID + ");" })
#Html.ActionLink("Delete", "AssetDelete", new{ id = item.ID }, new { #class = "ActionDelete", onclick = "return confirm('Are You Sure delete this record?');", })
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
and below is my controller that what i want to call when click on save button but 'img' is coming as null and after searching in google i found that to add #using(Html.BeginForm()) but still it is coming as null
[HttpPost]
public ActionResult AssetsPage(Asset ast, HttpPostedFileBase file)
{
using (GenericUnitOfWork gc = new GenericUnitOfWork())
{
if (HttpContext.Request.Files.Count > 0)
{
ast.ContainerName = "reports";
ast.BlobName = HttpContext.Request.Files[0].FileName;
ast.BlobUrl = BlobUtilities.CreateBlob(ast.ContainerName, ast.BlobName, null, GetStream(HttpContext.Request.Files[0].FileName));
ast.FileName = HttpContext.Request.Files[0].FileName;
}
gc.GetRepoInstance<Asset>().Add(ast);
gc.SaveChanges();
}
return RedirectToAction("AssetsPage");
}
Not able to find the solution. Please help or give some reference if possible.
Asp.Net MVC default model binding works with name attribute, So add name="file" attribute with input type="file" as shown :-
<input type="file" name="file" id="file" class="custom-file-input">
I'm having problems validating 2 textboxes using the [Compare-attribute. Even if they're same the client validation says they're different.
In my editmodel I have:
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[DataType(DataType.Password)]
[Compare("Password", ErrorMessage = "Password not matching")]
public string ConfirmPassword { get; set; }
In view:
<tr>
<td class="editor-label">
#Html.LabelFor(model => model.User.Password):
</td>
<td class="editor-field">
#Html.EditorFor(model => model.User.Password)
#Html.ValidationMessageFor(model => model.User.Password)
</td>
</tr>
<tr>
<td class="editor-label">
#Html.LabelFor(model => model.User.ConfirmPassword):
</td>
<td class="editor-field">
#Html.EditorFor(model => model.User.ConfirmPassword)
#Html.ValidationMessageFor(model => model.User.ConfirmPassword)
</td>
</tr>
Textboxes gets rendered as:
<input class="text-box single-line password" data-val="true"
data-val-required="Password missing" id="User_Password"
name="User.Password" type="password" value="" />
<input class="text-box single-line password" data-val="true"
data-val-equalto="Password not matching"
data-val-equalto-other="*.Password" id="User_ConfirmPassword"
name="User.ConfirmPassword" type="password" value="" />
<span class="field-validation-valid" data-valmsg-for="User.ConfirmPassword"
data-valmsg-replace="true"></span>
What might be wrong/missing here?
I updated unobtrusive + jquery validation using the Nuget packagemanager. And that did the trick