Question

I am using Ajax toolkit's Calendar Extender for taking date, now I want to call a javascript method on calendar's date selection change event, how do I do this? I am using following code for this

<asp:CalendarExtender ID="CalendarExtender2" runat="server" PopupButtonID="divCalendar"   TargetControlID="TxtHiddenFieldCalenderValue" >

and calling javascript method:-

function dateChanged(){
    alert("date");
}

Thanks,

Was it helpful?

Solution

You can have javascript function like,

function checkDate(sender,args)
{
    alert("hello");
}

and your ASP.net Code like these

<asp:CalendarExtender OnClientDateSelectionChanged="checkDate" PopupButtonID="XX" runat="server" TargetControlID="targetID" Format="dd/MM/yyyy" Enabled="True"></asp:CalendarExtender>

Hope this would be helpful.

sender._selectedDate.format(sender._format)  will give you selected date by Ajax Calender Extender.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top