views:

4334

answers:

2

I am using the date picker provided by jQuery UI to select a date range that ends up in a single text input with something like 11/11/2008 - 12/05/2008. What would you recommend as far a validation (jQuery/JavaScript) on the client side as well as code for validation on the server side (ASP.NET/C#) to make sure the user enters valid dates?

Note I asked a question on Stack Overflow the other day about how to parse out the two dates using C# if your interested.

+2  A: 

CustomValidator. Should be fairly simple to split these into two separate dates, parse each, and compare as necessary to verify the range is correct.

tvanfosson
+1  A: 

You can compare Dates with javascript fairly easily, just convert inputs to Date objects, and then any comparator would work. I use Date.js, as it has an excellent parser. On the backend, I would assume that you can do the same thing, the key is to convert all your objects to the same type, and one that can be compared to another.

Issac Kelly