I use TextBox
WebForm Control configured like a Bootstrap Datetimepicker
.
And I need to initiate server side TextChanged
event.
The code I have does not work so it does not call server side part.
HTML
<div class='datepicker input-group date' id='datetimepickerStart'>
<asp:TextBox ID="StartDate" class="form-control dateField" placeholder="Fecha" required runat="server" OnTextChanged="StartDate_TextChanged"></asp:TextBox>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
C#
protected void StartDate_TextChanged(object sender, EventArgs e)
{
// It does not fire :(
}
I try to force this event like this but no joy.
JS
$('#datetimepickerStart').datetimepicker();
$('#datetimepickerStart').datetimepicker().on('dp.change', function (event) {
console.log(event.date);
$('#StartDate').change(); // It does not help
$('#StartDate').html(event.date); // It does not help
});
Any clue how to fix it?
Solution is to add ApiController and consume via JQuery what I need.
https://blogs.msdn.microsoft.com/henrikn/2012/02/23/using-asp-net-web-api-with-asp-net-web-forms/