【发布时间】:2016-08-03 13:33:05
【问题描述】:
我使用 TextBox WebForm 控件,其配置类似于 Bootstrap Datetimepicker。
我需要启动服务器端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?
标签: c# asp.net webforms bootstrap-datetimepicker textchanged