Welcome Guest Search | Active Topics | Sign In | Register

Multiple Calendar Day Styles Options
Brian Brown
Posted: Thursday, December 22, 2011 10:23:25 AM
Rank: Member
Groups: Member

Joined: 4/9/2010
Posts: 12
I am using the calendar control with the multi-month enabled. I currently have the Windows_Multi_Month style selected for testing purposes. Is it possible to have multiple styles applied to different weeks within the calendar? For example.. I set selected dates to be the week of November 20 to 26 and I want that selection range to have a background color of orange, and I also have a selected date range of December 11 to 17 and I want that selection range to have a background color of blue. Is this possible? Thanks.
eo_support
Posted: Thursday, December 22, 2011 11:23:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That is possible with custom day rendering. In order to use custom day rendering, you would handle the Calendar control's DayRender event. That event is called for every day cell. You can then render each day cell yourself based on whatever logic you may have. For example, render a red DIV for the first day, render a blue DIV for the second day, etc.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Brian Brown
Posted: Thursday, December 22, 2011 12:34:22 PM
Rank: Member
Groups: Member

Joined: 4/9/2010
Posts: 12
Thanks for this.. could you provide a code sample as to how i render a day cell DIV myself?
eo_support
Posted: Thursday, December 22, 2011 1:17:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can take a look Demos -> Calendar -> Programming -> Editable Scheduler in the sample project for a working example of this feature. The full source of the sample project is in your installation folder when you install our controls.

The basic idea is you "write" anything you want into each cell. So for example, if you have something like this in your DayRender event handler:

e.Writer.Write("<div style='width:20px;height:20px;background-color:red;'></div>");

When this is called on every day cell by the Calendar, you get a 20 by 20 red square in every cell.

Thanks!
Brian Brown
Posted: Thursday, December 22, 2011 2:40:49 PM
Rank: Member
Groups: Member

Joined: 4/9/2010
Posts: 12
eo_support.. you are a blinding brilliant light from heaven. thanks.
eo_support
Posted: Thursday, December 22, 2011 2:56:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Glad to hear that. : ) Feel free to let us know if there is anything else.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.