Is there a way to set up the calendar extender so that the calendar displays when the text box recieves focus AND when the when the element with the "PopupButtonID" is clicked? With my current settings it seems to be one or the other.
A:
Hey,
Not that I'm aware of; it's one or the other. The only way I can think of is set it to use the popup control, then add a JS event handler for the textbox focus, and manually find the calendar extender, and there may be a show() method so you could manually invoke the trigger potentially. Not 100% sure. To find out do:
function textboxFocus() {
var c = $find("<%= calextenderid.ClientID %>");
//can use firebug to see if c.open method exists, or check for something else
}
Again, never done it, so not 100% sure.
HTH.
Brian
2010-05-11 16:42:37
+1
A:
It's a bit of an ugly way to do it, but you can do this if you're prepared to use two extenders.
<asp:TextBox runat="server" ID="DateTextBox" />
<asp:ImageButton runat="server" ID="CalendarImageButton" ImageUrl="~/date_16x16.gif" />
<ajaxtoolkit:CalendarExtender runat="server" id="Extender1" TargetControlID="DateTextBox"/>
<ajaxtoolkit:CalendarExtender runat="server" ID="Extender2" TargetControlID="DateTextBox" PopupButtonID="CalendarImageButton" />
This way the calendar will appear whether you focus on the textbox or click the imagebutton.
PhilPursglove
2010-05-11 16:55:04