Calendar Help

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top