Kendo Grid Validation
Kendo Grid Validation
Currently i am using Kendo Grid in my project to display data. And for validation of the same i have used kendo validator. Can any one kindly help me in making it generic, so that function can be used from any page which contains grid.
(function ($, kendo) {
$.extend(true, kendo.ui.validator, {
rules: { // custom rules
startdatetimevalidation: function (input, params) {
if ($(input).val() && $(input).attr('id') == "StartDateTime") {
if ($('#EndDateTime').val() && $(input).getKendoDateTimePicker().value() > $('#EndDateTime').getKendoDateTimePicker().value()) {
return false;
}
}
return true;
},
endatetimevalidation: function (input, params) {
if ($(input).val() && $(input).attr('id') == "EndDateTime") {
if ($('#StartDateTime').val() && $(input).getKendoDateTimePicker().value() < $('#StartDateTime').getKendoDateTimePicker().value()) {
return false;
}
}
return true;
}
},
messages: {
startdatetimevalidation: function (input) {
return "Start Date can't be greater than End Date.";
},
endatetimevalidation: function (input) {
return "End Date can't be smaller than Start Date.";
}
}
});
})(jQuery, kendo);
Thanks.
Dipak
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.