我正在使用C#,ASP.NET框架[非常新的環境]。這就是我想實現:從jQuery的日期選擇器的文本框jquery datepicker&c#/ aspnet - 異步數據庫查詢
- 將數據傳遞給控制器
- 從選定範圍解析日期,數據庫查詢
- 異步發送查詢行返回頁面更新內容
下面是HTML:
<form id="date" runat="server">
<asp:Label AssociatedControlId="from_date" Text="From:" runat="server" />
<asp:TextBox ID="from_date" Text="" runat="server" />
<asp:Label AssociatedControlId="to_date" Text="To:" runat="server" />
<asp:TextBox ID="to_date" Text="" runat="server" />
</form>
我對客戶的sid這個片段E要辦理變更事件:
var dates = $('#from_date, #to_date').datepicker({
if (this.id == "to_date")
$('#to_date').change();
});
在控制器撥打:
protected void to_date_UpdateHandler(object sender, EventArgs e) {
/* from here, I would query within the ranges in the "from_date"
and "to_date" textboxes */
}
顯然,這將導致頁面刷新,但我想通過數據一起異步。我應該如何去實現這個目標?謝謝。
的最佳解決方案。謝謝@Derek! –