我使用TextBox
WebForm控件配置爲像引導Datetimepicker
。 而我需要啓動服務器端TextChanged
事件。 我有的代碼不起作用,所以它不會調用服務器端部分。如何調用TextBox WebForm控件的TextChanged
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 :(
}
我試圖迫使這個事件是這樣,但沒有喜悅。
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
});
任何線索如何解決呢?方法不正確的
你的HTML說OnTextChanged = 「StartDate_TextChanged」,但您的服務器方法EndDate_TextChanged? – Steve