Solved

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

Posted on 2009-04-14
5
244 Views
Last Modified: 2013-11-26
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 www.asp.net) 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.
0
Comment
Question by:m1cajah
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
burakiewicz earned 125 total points
ID: 24140801
if (DateTime.Parse(TextBox1.Text).DayOfWeek == DayOfWeek.Friday)
                {

                }
0
 

Author Comment

by:m1cajah
ID: 24140831
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?

M
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 24140866
that would go in the codebehind, if you need javascript for the aspx page let me know
0
 

Author Comment

by:m1cajah
ID: 24141939
So I have to have code behind AND javascript on the ASPX page?
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 24147860
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.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question