I have created a server control.
In the CreateChildControls event, I have a textbox.
I would like to change this textbox to a calendar picker using the Ajax Calendar Extender, but what I have so far is not working...
private TextBox _txtStartDate;
private CalendarExtender _calExTxtStartDate;
protected override void CreateChildControls() {
... etc
_txtStartDate = new TextBox();
_txtStartDate.ID = "txtStartDate";
_calExTxtStartDate = new CalendarExtender();
_calExTxtStartDate.ID = "calExTxtStartDate";
_calExTxtStartDate.TargetControlID = "txtStartDate";
... etc
Controls.Add(_txtStartDate);
Controls.Add(_calExTxtStartDate); // Calendar Extender
... etc
}
I already have an AjaxScriptManager in the page that the control is consumed, so have not added another (and errors with a 'duplicate script manager' error when I do).
I am able to get this working when using the designer to add the calendar on a page, but not in the server control... Am I missing something?
I think you would have to do it as: