G
Gef.Mongoose
Hi all. I'm populating using a dataset to highlight dates in a calendar
control. The code i'm using is:
if (!e.Day.IsOtherMonth)
{
foreach (DataRow dr in _ds.Tables[0].Rows)
{
if ((dr["startdate"].ToString() != DBNull.Value.ToString()))
{
DateTime dtEvent = (DateTime)dr["startdate"];
if (dtEvent.Equals(e.Day.Date))
{
e.Cell.BackColor = System.Drawing.Color.PaleVioletRed;
e.Cell.ID = dr["idcourse"].ToString();
}
}
}
}
The dates are coloured in correctly, but the programmatically set ID
seems to always contain "Cal" regardless of what I put into it. What am
i doing wrong? I could use the selected date to find the records
holding the coloured date, but I'm curious as to why the ID function is
not working.
Also, at the moment I am pulling all the records out of the database,
would it be more efficient to only pull out the dates of the month
currently displayed on the calendar?
paul
control. The code i'm using is:
if (!e.Day.IsOtherMonth)
{
foreach (DataRow dr in _ds.Tables[0].Rows)
{
if ((dr["startdate"].ToString() != DBNull.Value.ToString()))
{
DateTime dtEvent = (DateTime)dr["startdate"];
if (dtEvent.Equals(e.Day.Date))
{
e.Cell.BackColor = System.Drawing.Color.PaleVioletRed;
e.Cell.ID = dr["idcourse"].ToString();
}
}
}
}
The dates are coloured in correctly, but the programmatically set ID
seems to always contain "Cal" regardless of what I put into it. What am
i doing wrong? I could use the selected date to find the records
holding the coloured date, but I'm curious as to why the ID function is
not working.
Also, at the moment I am pulling all the records out of the database,
would it be more efficient to only pull out the dates of the month
currently displayed on the calendar?
paul