Saturday, March 24, 2012

Me and my calendar

im having so much trouble with the asp.net calendars and i cant even begin to understand how the language works. so here is a dumb question:

i have two calendars on my webform - one is the main calendar for holding events and the other is just a normal calendar. what i need is the smaller calendar to be able to reference the larger calendar. i.e if the larger (events) calendar is showing the month of april then the smaller calendar should show the month of May. so the smaller calendar is always displaying the month, one month ahead of the larger events calendar.

can anyone show me in c# how to do this please??

(im using asp.net built in calendars)

if you lookup the calendar control'sVisibleMonthChanged event there is some sample code that does something similar.

ive had a look at the documentation and ive got it to work for something else i was stuck on but not the thing that i wanted it too. i have the following code but im getting stuck on how to display the next/previous month from one calendar based on the month value of another calendar.

publicvoid showChange (Object src, MonthChangedEventArgs e)
{
if ( e.NewDate.Month > e.PreviousDate.Month )
Calendar2.VisibleDate = e.NewDate.ToString();

if ( e.NewDate.Month < e.PreviousDate.Month )
Calendar2.VisibleDate = e.PreviousDate.ToString();
}

i dont know if this right or not, but can someone point me in the right direction please?

0 comments:

Post a Comment