Solved

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

Posted on 2009-04-14
5
245 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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