Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want a date picker code.

What I want is that only dates related to Monday should me selected. A user cannot select dates other than Monday.

After the selection of Monday date there are other 6 textboxes that needs to be filled up auto.

Ex.

17-11-2014 (dd-mm-yyyy)is selected by the user.
The next text boxes need to be filled up like 18,19,20...22-11-2014

If you require more detail please contact me. onlybigb321@gmail.com

Thanks
Posted

1 solution

If you want to do it using ASP.NET (server-side) code then you might want to look at the DateTime.DayOfWeek property of the DateTime instance.

What you would do, is to send the DateTime that the user selected, and on the server side, check the Day for that DateTime as

C#
if(dateTime1.DayOfWeek == DayOfWeek.Monday) {
   // yes the dateTime is monday
} else {
   // no, he selected any other day
}


You can then fill the remaining Controls by the data depending on this. More on DateTime.DayOfWeek here on MSDN[^].
 
Share this answer
 
Comments
aarif moh shaikh 20-Nov-14 7:56am    
good.......
Afzaal Ahmad Zeeshan 20-Nov-14 8:00am    
Thanks Aarif. :-)
onlybigb321 21-Nov-14 0:43am    
@Afzaal Ahmad Zeeshan, I want it the Designing side.
Such as the user cannot at all select other days, but only MONDAY.
Other days are visible, but disabled(can't be selected).
Afzaal Ahmad Zeeshan 21-Nov-14 0:58am    
Why don't you set them to be disabled? disabled attribute can be added to any HTML attribute which you want to set as not clickable. What does you datetime selector allows you to?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900