ASP.NET Calendar - Knowledge Base

« Back to Knowledge Base list

Close datepicker using client method

Q:

How to close datepicker using client method?

A:

Call client side method displayCalendar.

JavaScript

function CloseCalendar()
{
        if (Calendar1.Io) // check if calendar is visible
        {
                Calendar1.displayCalendar(false);
        }
}

ASPX


<asp:textbox runat="server" id="txtDate" />
<obout:Calendar runat="server"
        DatePickerMode = "true"
        TextBoxId = "txtDate" id="Calendar1"
        DatePickerImagePath = "styles/icon2.gif" >

<input type="button" value="Close" onclick="CloseCalendar()" />