Solved

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

Posted on 2009-04-14
5
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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