|
Rank: Newbie Groups: Member
Joined: 8/28/2008 Posts: 3
|
When you load a multi-month calendar, the month of the current date is displayed in the upper left, and future months fill out the rest of the calendar. Is there a way to have the selected month be the last month displayed, and have previous months show up instead of future months?
For example, if the selected date was August 1, 2008, a 4-month calendar will show Aug/Sept/Oct/Nov. I would like it to show May/June/July/Aug instead.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
I do not think there is an option to control that. One thing you can try is to set the Calendar's VisibleDate property. That property controls which month would be the first visible month. I believe setting SelectedDate automatically set VisibleMonth, however setting VisibleMonth does not change SelectedDate.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 8/28/2008 Posts: 3
|
Thanks! That seems to work when the control is first rendered, but once you pick another date that month is set as the first month. I set the AutoPostbackOnSelect to True and reset the VisibleDate property in the SelectionChanged event, but that doesn't seem to have any effect.
Protected Sub DatePicker1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DatePicker1.SelectionChanged DatePicker1.VisibleDate = DateAdd(DateInterval.Month, -3, DatePicker1.SelectedDate) End Sub
Stepping through the code, VisibleDate gets set correctly, but it doesn't seem to pass through to the display.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
That's interesting. We will take a look and let you know what we find.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
We have posted a new build that fixed this problem. Please download it from our download page.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/28/2008 Posts: 3
|
Works perfectly now, thanks!
Here's the code for anyone else trying to do this:
Protected Sub DatePicker1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DatePicker1.PreRender If DatePicker1.SelectedDate = #12:00:00 AM# Then DatePicker1.VisibleDate = DateAdd(DateInterval.Month, -3, Now) Else DatePicker1.VisibleDate = DateAdd(DateInterval.Month, -3, DatePicker1.SelectedDate) End If End Sub
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Thanks for the update!
|
|