Dear all,
I am crating personal event calendar with asp.net 2.0.
I am facing with problem with showing event that take more than one day in asp.net calendar.
when I show in asp.net 2.0 calendar I can only show one day event only.
How to show like this one (google calendar)
[img=http://img204.imageshack.us/img204/893/calendarpv2.gif]
I want to show event over days
please kindly give me advice.
Here is my code:
protected void EventCalendarDayRender(object sender, DayRenderEventArgs e)
{
CalendarDay d = ((DayRenderEventArgs)e).Day;
TableCell c = ((DayRenderEventArgs)e).Cell;
// If there is nothing to bind
if (this.EventSource == null)
return;
DataTable dt = this.EventSource;
foreach (DataRow dr in dt.Rows)
{
if (EventDateColumnName == string.Empty)
throw new ApplicationException("Must set EventCalendar's EventDateColumnName property when EventSource is specified");
if (EventHeaderColumnName== string.Empty)
throw new ApplicationException("Must set EventCalendar's EventHeaderColumnName property when EventSource is specified");
if (EventDateColumnName != string.Empty
&& !d.IsOtherMonth
&& Convert.ToDateTime(dr[this.EventDateColumnName]).ToShortDateString() == d.Date.ToShortDateString())
{
//Changes made for align the events
c.ColumnSpan = 2;
c.Controls.Add(new LiteralControl("<fieldset>")); //class=" + EventStyleName + "
System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
lbl.Text = dr[EventHeaderColumnName].ToString();
//lbl.CssClass = EventStyleName;
lbl.Width = Unit.Percentage(98);
lbl.Attributes["OnClick"] = "showPopWin('EventEdit.aspx?ID=" + dr[EventIDColumnName].ToString() + "', 580, 400, null);";
//c.Controls.Add(lbl);
if (this.ShowDescriptionAsToolTip)
{
if (this.EventDescriptionColumnName != string.Empty)
{
//Multiline ToolTips
lbl.ToolTip = string.Format(dr[EventDescriptionColumnName].ToString(),Environment.NewLine );
}
}
c.Controls.Add(lbl);
c.Controls.Add(new LiteralControl("</fieldset>"));
}
}
}