I have the following code to programmatically create a DatePicker
case
"date"
:
var dt =
new
RadDatePicker { ID = $
"keyword_{keyword.keyword_id}"
};
var day =
new
RadCalendarDay
{
Repeatable = RecurringEvents.Today,
Date = DateTime.Today
};
day.ItemStyle.BackColor = Color.LightGray;
day.ItemStyle.Font.Bold =
true
;
day.ItemStyle.BorderStyle = BorderStyle.Solid;
day.ItemStyle.BorderColor = Color.Black;
day.ItemStyle.BorderWidth =
new
Unit(1);
if
(dt.SharedCalendar ==
null
)
{
dt.SharedCalendar =
new
RadCalendar();
}
dt.SharedCalendar.SpecialDays.Add(day);
cell1.Controls.Add(lbl);
cell2.Controls.Add(dt);
break
;
and I receive the following on the page when I try to view it:
Value cannot be null or empty.
Parameter name: componentID
I've got it narrowed down to the SharedCalendar not having an ID value, and when I set it to some value, I now get an error in the JS console:
Uncaught Sys.InvalidOperationException: Sys.InavalidOperationException: Compnoent 'cal_keyword_134' was not found
How can I create a Date Picker programmatically and have the popup calendar highlight "today"?