how to comp开发者_如何学Care 2 dates using java script code in custom validator C# and print the message in a label if the from date is greater than to date
A useful date manipulation library that I've had success with in the past is date.js.
Here's a link - http://www.datejs.com/
Read the getting started guide, and when you're happy with it, take a look at the IsAfter function. Here's a link - http://code.google.com/p/datejs/wiki/APIDocumentation#isAfter
In terms of converting from a C# date string to a Date.js date object, I think that Date.js will recognise a C# datetime string with no extra work. Something like this might get you started:
var date1 = Date.parse('<%= Date1.ToString() >');
var date2 = Date.parse('<%= Date2.ToString() >');
var result = date1.isAfter(date2)
精彩评论