I want to pass the datetimepicker value to my Codebehind (C #) and store it in a variable in C #.
I tried it with a hidden field, but it does not work.
here is the js code:
var dates = $("#ArrivalStartDatepicker").datetimepicker({
defaultDate: "+lw",
dateFormat: 'dd-mm-yy',
changeMonth: true,
numberOfMonths: 2,
ampm: true,
stepMinute: 10,
minuteGrid: 10,
onSelect: function (selectedDate) {
document.getElementById("ArrivalStart").value = dates.datetimepicker('getDate');
}
});
hidden field:
<div>
<input type="hidden" id="ArrivalStart" runat="server"/>
</div>
when I select a date or time, firebug raises the following error:
document.getElementById ("ArrivalStart") is null
this tells me that ArrivalStart-Field is not available in JS.
How can I manage this?
Greetz
Tobi
source
share