Calendar control...

R

RAB

I want to make my calendar control only be able to change the month
for the current year. ie I want to be able to scroll to Feb 07, Jan
07 but not to Dec 06. Any ideas of how to set this functionality up?

Thanks,
RABMissouri2007
 
G

Guest

Hello RAB,

One way to do this would be to handle the VisibleMonthChanged event. In the
event handler you could have code which looked like this:
=-=-=-=-=-=-=-
protected void Calendar1_VisibleMonthChanged(object sender,
MonthChangedEventArgs e)
{
DateTime dt = new DateTime(DateTime.Now.Year, 2, 1);

// check to see if the newdate is before feb, if it is get rid of
the prevmonthtext
if (e.NewDate < dt)
{
Calendar1.PrevMonthText = "";
}
// if the new date is greater than jan, set the text
else
{
Calendar1.PrevMonthText = "<";
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top