DatePicker Bug

Topics: Developer Forum
Apr 10, 2009 at 7:15 AM
protected override void CreateChildControls()
{
DatePickerBox.ID = ID + "_date";
Controls.Add(DatePickerBox);
DatePickerBox.CssClass = "datePicker";
DatePickerBox.TextChanged += OnTextChanged;

DatePickerBox.ID = ID + "_time";
Controls.Add(TimePickerBox);
TimePickerBox.CssClass = "timePicker";
TimePickerBox.TextChanged += OnTextChanged;

base.CreateChildControls();
}

Notice you set the DatePickerBox.ID both times, whereas you should set the TimePickerBox the in the second block of code.

Daniel
Apr 11, 2009 at 8:50 PM
Moreover, 
DatePickerBox.ID = ID + "_date"
should be reduced to something simpler:
DatePickerBox.ID = "date"
also, the container control itself should implement INamingContainer to warrant uniqueness of enclosed DatePickers
Coordinator
Apr 16, 2009 at 9:49 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.