tags:

views:

218

answers:

3

I am trying to simply have the calendar close when a user clicks anywhere on the page. I have downloaded the most recent version of the toolkit and I can not get this functionality to work. I am not sure if I am missing a property but the functionality works as expected on the asp.net sample toolkit page.

Here is the code:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>


<asp:TextBox ID="txtTest" runat="server" /><img runat="server" alt="Calendar" id="imgCalFrom" align="absmiddle" border="0" height="16" src="/global/images/glo_btn_cal.gif" width="21"/>
    <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTest" PopupButtonID="imgCalFrom">
    </asp:CalendarExtender>
A: 

Remove the PopupButtonID="imgCalFrom" from the extender. That should fix it. This PopupButtonID assigns a button callback. You have to click the image again or selecting a date in order to close the calendar.

madatanic
Correct, but hen you loose the functionality of having a user click on the button to display the calendar. So the question is, how do I have a calendar icon associated with a textbox that when clicked displays the calendar but when any other part of the page is clicked, the calender is hidden again.
TampaRich
If you are using an <img> tag for the PopupButtonID, switch to using ImageButton instead as below <asp:ImageButton ID="imgCalFrom" runat="server" ImageUrl="~/Images/calendar.jpg" />
madatanic
Then you loose the functionality of having a button fire the event to show the calendar.
TampaRich
A: 

Don't use <img .,. />. Use <input type="image" .../> instead. Or you can use <asp:ImageButton runat="Server" .../>. This will fix your problem.

Bamba
A: 

Yes it worked, Thanks. Simple solution.

Girishnagose