Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 99250

Programatically Create DatePicker

$
0
0

I have the following code to programmatically create a DatePicker

case"date":
    var dt = newRadDatePicker { ID = $"keyword_{keyword.keyword_id}"};
    var day = newRadCalendarDay
    {
      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 = newUnit(1);
    if(dt.SharedCalendar == null)
    {
      dt.SharedCalendar = newRadCalendar();
    }
    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"?

 


Viewing all articles
Browse latest Browse all 99250

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>