internal void FillDropPanel(DataTable dt) { if (DateTimeFieldName == string.Empty) { throw new Exception("DateTimeFieldName can't be null, set the property DateTimeFieldName"); } string startDate = firstDayOfTargetDateTime.ToString("yyyy-M-d"); string endDate = firstDayOfTargetDateTime.AddDays(columnNum * rowNum - 1).ToString("yyyy-M-d"); string sqlExpress = DateTimeFieldName + " >= '" + startDate + "' And " + DateTimeFieldName + " <= '" + endDate + "'"; DataRow[] filterData = dt.Select(sqlExpress, DateTimeFieldName); List <string> highLightDayList = new List <string>(); foreach (DataRow dr in filterData) { DateTime date = ((DateTime)dr[DateTimeFieldName]); string id = dr[KeyField].ToString(); string title = dr[TitleFieldName].ToString(); string description = dr[DescriptionFieldName].ToString(); DropPanel _dropPanel = CalendarCellControlList[(date - firstDayOfTargetDateTime).Days].GenerateDropPanel(id, date, title, ""); DropPanelClientIDCollection.Add(_dropPanel); string dateStr = date.ToString("yyyy-M-d"); if (!highLightDayList.Contains(dateStr)) { highLightDayList.Add(dateStr); } } DateTimePicker.HighLightDayList = highLightDayList; DateTimePicker.HighLightDayListType = "yyyy-M-d"; }
public virtual DropPanel GenerateDropPanel(string id, DateTime date, string title, string description) { DropPanel dropPanel = new DropPanel(); dropPanel.ID = "dropPanel" + id; dropPanel.FromContextKey = new { key = id, datetime = date.ToString("yyyy-M-d") }; dropPanel.HeaderText = title; dropPanel.ToolTip = title; dropPanel.ContentText = description; Content.Controls.Add(dropPanel); return(dropPanel); }
public virtual DropPanel GenerateDropPanel(string id, DateTime date,string title, string description) { DropPanel dropPanel = new DropPanel(); dropPanel.ID = "dropPanel"+id; dropPanel.FromContextKey = new { key = id, datetime = date.ToString("yyyy-M-d") }; dropPanel.HeaderText = title; dropPanel.ToolTip = title; dropPanel.ContentText = description; Content.Controls.Add(dropPanel); return dropPanel; }