Welcome Guest Search | Active Topics | Sign In | Register

Calendar dates become invisible on custom dates rendering Options
Oleh
Posted: Wednesday, December 29, 2010 10:44:37 AM
Rank: Newbie
Groups: Member

Joined: 12/29/2010
Posts: 7
I try to implement custom rendering (disabling/hiding dates depending on input params), something like below

DateTime dAllowdate = DateTime.Today.AddDays(-1);
if (e.Day.Date <= dAllowdate.Date)
{
e.Cell.ForeColor = System.Drawing.Color.gray;
e.Day.IsSelectable = false;
}
else
{
e.Cell.ForeColor = System.Drawing.Color.green;
}

But when implementing any DayRender hadler, even empty, all calendar dates become invisible, see image

eo_support
Posted: Wednesday, December 29, 2010 11:35:08 AM
Rank: Administration
Groups: Administration

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

That's normal. When you handle DayRender event, you must actually renders the cell content. Just setting the color will not do it. For example, the following code writes the day number in the cell:

Code: C#
e.Writer.Write(e.Day.DayNumberText);


You can replace that call (or even omit it as in your case) with anything else. This allows you to render anything in day cell and that's what custom rendering is for.

Thanks!
Oleh
Posted: Wednesday, December 29, 2010 1:22:31 PM
Rank: Newbie
Groups: Member

Joined: 12/29/2010
Posts: 7
Thank you!


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.