Reputation: 355
I'd like to use an ajaxToolkit:CalendarExtender on an asp:Label. When I attach a CalendarExtender to the label, I get the error:
Extender controls of type 'AjaxControlToolkit.CalendarExtender' cannot extend controls of type 'System.Web.UI.WebControls.Label'.
I'm hoping someone knows a quick trick to allow me to display a date in a label and allow that label to be clicked to trigger/open a CalendarExtender which might target a hidden asp:TextBox... if that's possible.
Upvotes: 0
Views: 6271
Reputation: 125488
As the error states, the Calendar extender is constrained to extend only textbox controls by default.
Looking at the ASP.NET AJAX Control toolkit page for the Calendar extender, you should be able to use the PopupButtonID
to enable the label to trigger the calendar popup (you'll need to add in the unhiding of the textbox too).
Upvotes: 1
Reputation: 1325
If you have the source code of AjaxControlToolkit you can edit CalendarExtender.cs and then change
[TargetControlType(typeof(TextBox))]
and put Label (or Control if you want to have only one calendar extender) . Don't know how that will afect general behaviour of the Extender.
Upvotes: 0