How best to make the selected date of an ASP.NET Calendar control available to JavaScript?
Most controls are pretty simple, but the calendar requires more than just a simple document.getElementById().value.
How best to make the selected date of an ASP.NET Calendar control available to JavaScript?
Most controls are pretty simple, but the calendar requires more than just a simple document.getElementById().value.
This might help you. It uses YUI, but you can probably port some of that functionality over to another library or custom code it. It should get you started though.
http://www.codeproject.com/KB/aspnet/aspnet-yahoouicalendar.aspx
When you click on a date with the calendar, ASP does a postback, you could always put the SelectedDate value of the calendar control into a hidden field on the page during the OnLoad event of the page or the SelectionChanged event of the Calendar control.
I'm using Page.ClientScript.RegisterClientScriptBlock() to put a small script on the page that just declare a variable with the desired value. I was hoping for some a little less... clunky.