Trouble getting compare validator working
Have a grid (mvc, razor) with popup editing. 2
password fields that should compare. On the model I’ve data annotated:
How to get validation working?
I have implemeted a solution found else where on your forum - it's working but not pretty:
Have a grid (mvc, razor) with popup editing. 2
password fields that should compare. On the model I’ve data annotated:
[DataType(DataType.Password)][Compare("Password")]How to get validation working?
I have implemeted a solution found else where on your forum - it's working but not pretty:
.Events(events => events.Error("grid_error"))<script>
function grid_error(e) {
if (e.errors) {
var message = "There are some errors:\n";
// Create a message containing all errors.
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
// Display the message
alert(message);
// Cancel the changes
var grid = $("#grid").data("kendoGrid");
grid.cancelChanges();
}
}
</script>