Skip to content
DayPilot

How to show Year with month name in monthview control

Asked by Khalid Mehmood
18 years ago.

currently it is showing only months name in month view.. i want to show year with month like

january 2008 , february 2008 .....

help me plz...

thanks

Answer posted by Dan Letecky
18 years ago.
You should handle BeforeCellRender event and change e.HeaderText.

See an example from Demo/Month/CustomRendering.aspx.cs (visible as www.daypilot.org/demo/Month/CustomRendering.aspx). This example sets the cell header font to bold by wrapping it inside <span> element.
protected void DayPilotMonth1_BeforeCellRender(object sender, 
DayPilot.Web.Ui.Events.Month.BeforeCellRenderEventArgs e)
{
if (e.Start == DateTime.Today)
{
e.HeaderText = String.Format("<span style='font-weight:bold'>{0}</span>", e.Start.Day);
e.HeaderBackColor = "#FFD3BD";
}
}
For showing day + month + year, you can use something like this:
e.HeaderText = String.Format("{0:d MMMM yyyy}", e.Start);

This question is more than 1 month old and has been closed. Please create a new question if you have anything to add.