Calendar - Outlook Type

  • Thread starter Thread starter Martin Schmid
  • Start date Start date
M

Martin Schmid

Is there a Web Control that I can use to generate a calendar similar to an
Outlook calendar... I.e, if I have a event on a given date, show that event
on that day on the calendar... likewise, If I have an event spanning
multiple dates, show a bar across all the dates... and if there are several
multi-day events, create multiple bars, from their respective start to end
dates...
 
Hi Martin
There is the calendar server side control. And here is an example that
does something similar (yet simple) to what you want to do.
In this example we want to display a message that reads "Friday" below
every Friday displayed in the calendar. You also want to find all the
weekdays for the current month displayed in the calendar and show them with
a yellow highlight.

So we define the control in page.aspx as follow

<asp:calendar id="WorkDays" runat="server"
OnDayRender="WorkDays_DayRender"/>


Then we write the event handler as follows
private void WorkDays_Render(object source,DayRenderEventArgs e)
{

if (e.Day.Date.DayOfWeek == DayOfWeek.Friday)
{
e.Cell.Controls.Add(new
LiteralControl("Friday"));
}
if (!e.Day.IsWeekend && !e.Day.IsOtherMonth)
{
e.Cell.BackColor = System.Drawing.Color.Red;
}
}
Hope this would help
 
Back
Top