Now we are ready to override the Is Valid method where we are going to implement the actual business rule validation.
I have used Switch statement here to check which Validation Type the user is requested for. Here Validation Result represents a container for the results of a validation request.
Using the ‘Required’ Data Annotation I can check if the Date is entered or not, Date Format can be validated using the Regular Expression Validator, but to validate some of the specific case like Comparing the From Date and To Date, Minimum date should not less than 2005, etc we need to create our Custom Validation Classes. In this example I am creating a class named Date Validation which extends base class ‘Validation Attribute’ of System. And before we override the Is Valid method we have to pass the initialization parameters to our Date Validation Attribute class constructor with the from Date, to Date Validation Type, default Error Message and base Property Name, here property Name To Compare is the property name of the ‘From Date’.
We are going to need ‘From Date’ to compare with To Date and Validate the Dates.
Now with 1.11.0, no matter if I enter a valid value like 10, 15, 20, etc..., it barks at me telling that the value must be between 0 and 150.
Here's the HTML code generated: By replacing new versions of js libraries with old ones I figured out that the problem is indeed in jquery.library.
Meanz not find the correct result in between queryselect * from tbstd_rec where joiningdate between '1/6/2013' and '10/6/2013'Return all rows where data exists between 1/6 -- 10/6 either record is 2009,2011,2013 record..In the code above I am keeping the form method as post and Action to my Date Validation Action of Home Controller.This quick post shows how to validate two date fields by comparing their values.So using this event, set the date range for other date pickers.For example, when from date is selected, then using this "on Select" event we will set the "min Date" attribute of "txt To Date" textbox to the selected date in "txt From Date". I live in World Wide Web and from there take care of this website.