How do I validate that a date selected in a date picker is a Friday?

Greetings Experts,

My users are submitting reports. The status date for the report has two conditions: (1) it cannot be for a previous week and (2) it must be a Friday.

I know how to set a comparison validator on the text field where the date picker puts the selected date (to make sure it's not in the past), but what I cannot figure out for the life of me is how to validate the user's selection is a Friday (and this could change - may become a Monday in the future).

I'm using Visual Studio 2008, with the Ajax Toolkit (from for the calendar control extender on the text box.

And I'm a noob - so please be gentle with me!  :D

Is there a "visual " way to do this? I've sorta been thrown to the wolves on this one and to be honest wouldn't know how to code if my life depended on it.
Who is Participating?
burakiewiczConnect With a Mentor Commented:
if (DateTime.Parse(TextBox1.Text).DayOfWeek == DayOfWeek.Friday)

m1cajahAuthor Commented:
Hi burakiewicz,

That was fast!  Now... where does that go? It doesn't go in the ASPX page source does it? Or is that "code behind" where I double-click on the text field and it opens a VB file that is used to support that page?

that would go in the codebehind, if you need javascript for the aspx page let me know
m1cajahAuthor Commented:
So I have to have code behind AND javascript on the ASPX page?
you can have either.  You can do it with code behind server side.  Or you can do it client side with javascript.  These are 2 seperate ways of doing it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.