Calendar Month
-
Is there a way that i can have the calendar show a different month? I need it to show dates for March not Feburary. Thanks in advanced Tommy
-
Is there a way that i can have the calendar show a different month? I need it to show dates for March not Feburary. Thanks in advanced Tommy
Yes. Take a look at the Calendar's
VisibleDate
property in the MSDN documentation. Hope that helps. :) --Jesse -
Yes. Take a look at the Calendar's
VisibleDate
property in the MSDN documentation. Hope that helps. :) --JesseI took a look at that but it makes no sense to me at all. I'm really new to the programming environment. Would you or anyone be able to give me an example of how to add just 1 month past the current month on the calendar? I'm trying to do this in the page_load of the webform. Thanks Tommy
-
Yes. Take a look at the Calendar's
VisibleDate
property in the MSDN documentation. Hope that helps. :) --JesseOk i got it working. Just one more question. Can you have more than 1 selected range on the calender?
-
I took a look at that but it makes no sense to me at all. I'm really new to the programming environment. Would you or anyone be able to give me an example of how to add just 1 month past the current month on the calendar? I'm trying to do this in the page_load of the webform. Thanks Tommy
Sure. Lets assume that we have a calendar on the page called "myCalendar". The code may look something like:
private void Page_Load(object sender, System.EventArgs ea)
{
// Add one month to today's date. No need to worry about
// months not having the same number of days, .NET will handle
// that. For example, adding a month to January 31st gives us
// a date of February 28th.
DateTime nextMonth = firstOfThisMonth.AddMonths(1);
// Set the VisibleDate property of the calendar, so that it will display
// the month of the date.
myCalendar.VisibleDate = nextMonth;
}
Hope that helps. :) --Jesse
-
Ok i got it working. Just one more question. Can you have more than 1 selected range on the calender?
D'OH. Didn't see this reply before I made my previous one. :doh: It appears that you can have multiple ranges selected. For example, assume that we have a calendar control on the page called "myCalendar". The following works for me:
private void Page_Load(object sender, System.EventArgs ea)
{
myCalendar.SelectedDates.Add(DateTime.Parse("02/01/2005"));
myCalendar.SelectedDates.Add(DateTime.Parse("02/02/2005"));
myCalendar.SelectedDates.Add(DateTime.Parse("02/03/2005"));
myCalendar.SelectedDates.Add(DateTime.Parse("02/25/2005"));
myCalendar.SelectedDates.Add(DateTime.Parse("02/26/2005"));
myCalendar.SelectedDates.Add(DateTime.Parse("02/27/2005"));
}
Hope that helps. :) --Jesse