using javascript onchange to fill a calendar
- by scatman
i have a calendar and a textbox in my c# asp.net application.
when a user enters a date in the textbox, the selected date in the calendar should become the date entered in the text box. the hard part is that i need to do this in javascript.
what i have now is this:
<asp:TextBox ID="txtDate" runat="server" onchange="javascript: Changed( this );" />
<asp:Calendar ID="calDate" runat="server" />
<script type="text/javascript">
var calendarID = '';
function Changed(textControl)
{
var date = Date.parse(textControl.value); //this is giving me the date in seconds
var cal = document.getElementById(calendarID);
}
</script>
and i am setting calendarID in this way:
<script type="text/javascript">
calendarID = "<%=calDate.ClientID%>";
</script>
there is no cal.selectedDate or anything like this... any help?