Hi I have looked at the code demos and looked at the calendar sample site and would like to know why the function that i'm trying to loosely base on day render function doesn't want to work this is my code
what i need it do do is colour the cells that dont fit into the if statement red is there anything that i can do?
| TableCell currentCell = new TableCell(); |
| RadCalendarDay day = new RadCalendarDay(RadCalendar1); |
| MonthView view = new MonthView(RadCalendar1); |
| Telerik.Web.UI.Calendar.DayRenderEventArgs e = new Telerik.Web.UI.Calendar.DayRenderEventArgs(currentCell, day,view); |
| DateTime CurrentDate = RadCalendar1.SelectedDate; |
| backgroundColor1 = Color.Red.Name; |
| backgroundColor = Color.Green.Name; |
| currentCell = e.Cell; |
| currentCell.Style["background-color"] = backgroundColor; |
| string Connection = "Data Source=62.197.41.101; Initial Catalog=PilotWebApp; User ID=sa; Pwd=medularis;"; |
| SqlConnection conn = new SqlConnection(Connection); |
| SqlCommand cmd = new SqlCommand("Slot_sp_EngineerTimeslots_Group", conn); |
| cmd.CommandType = CommandType.StoredProcedure; |
| cmd.Parameters.AddWithValue("@PROPREF", strPropref); |
| cmd.Parameters.AddWithValue("@PRIORITYCODE", PRIORITYCODE); |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); |
| cmd.Parameters.AddWithValue("@TIMESLOT", "AT"); |
| conn.Open(); |
| SqlDataReader reader = cmd.ExecuteReader(); |
| DataTable dt = new DataTable(); |
| dt.Load(reader); |
| DayOfMonth = DateTime.Today.Day; |
| int rows = dt.Rows.Count; |
| endDate = RadCalendar1.SelectedDate.AddDays(rows); |
| foreach (DataRow dr1 in dt.Rows) |
| { |
| startDate = DateTime.Parse(dr1["BookedDate"].ToString()); |
| if (CurrentDate >= startDate.Date && CurrentDate <= endDate.Date) |
| { |
| Label label = new Label(); |
| label.Text = e.Day.Date.Day.ToString(); |
| label.BackColor = System.Drawing.Color.Green; |
| e.Cell.Controls.Add(label); |
| // disable the selection for the specific day |
| RadCalendarDay calendarDay = new RadCalendarDay(); |
| calendarDay.Date = CurrentDate; |
| calendarDay.IsSelectable = true; |
| RadCalendar1.SpecialDays.Add(calendarDay); |
| } |
| CurrentDate.AddDays(1); |
| } |
what i need it do do is colour the cells that dont fit into the if statement red is there anything that i can do?