views:

176

answers:

1

Hi,

I have a textbox extended with the calendar extender in ASP.NET Ajax. If I get the selected date of the calendar, the variable is null, and the text of the textbox always defaults to the value I specified (Default) for when the page loads.

How can I get the selected date when I change it? I need this for the button click event handler.

Thanks

A: 

Hey,

The calendar extender has a selectedDate() property on the client-side API, and a dateSelectionChanged event if you need immediate notification; you can get the selected date via:

var date = $find("<%= cal1").get_selectedDate();

which should be not null; I looked in the JS and it is setting it when clicking on the day.

HTH.

Brian
Is there a way to get this via C#?
dotnetdev
CalendarExtender.SelectedDate, though I don't know if that refreshes based on what was last selected on the server. However, on the server, the textbox should have the date value.
Brian
That didn't seem to work for me.
dotnetdev
What part didn't work, the server-side selecteddate property?
Brian