Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > How to change default calendar month? View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 8/6/2012 3:33:16 AM
   
How to change default calendar month?
Hi Guys,

I am using the webpart called "Calendar". When it loads it shows me the current month.

Is there a way to tell the calendar to show the next month by default when it loads?

Thanks
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_janh - 8/6/2012 5:35:09 AM
   
RE:How to change default calendar month?
Hello,

Of course, please just edit the OnContentLoaded method in the \CMSWebParts\Events\EventCalendar.ascx.cs file and add there the following code:

public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();

DateTime UneDate = CMSContext.ConvertDateTime(DateTime.Now.AddMonths(1), this);
ViewState["CalendarDate"] = UneDate;
calItems.VisibleDate = UneDate;
ReloadData();


}


Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 8/8/2012 8:25:37 PM
   
RE:How to change default calendar month?
Hi Jan,

Works great. Thanks for providing the code. Really Appreciated.

Cheers
Gitesh Shah