使用 ASP.NET 文本框和 AjaxControlToolkit CalendarExtender 的 AutoPostBack
我想在用户选择日期后触发回发。我正在使用 AjaxControlToolkit 的 CalendarExtender 控件。与扩展器关联的日期文本框也是可编辑的,这使得用户能够以特定格式手动输入日期。驻留在该页面上的相当多的控件的值将根据新选择的日期进行更新,因此必须访问服务器。 我确实尝试使用扩展器的 OnClientDateSelectionChanged 属性,它可以让我挂钩我的自定义 JavaScript,我计划使用它触发回发,但由于某些奇怪的原因,仅当使用扩展器选择日期时才会调用该函数,而不是手动选择日期时已编辑(希望它不会捕获文本框更改上的点击事件)。
我相信很多人之前已经解决过这个问题。请分享。谢谢。
I would like to like to trigger a postback after user selects a date. Am using the AjaxControlToolkit's CalendarExtender control. The date textbox which is associated to the extender is editable too which enables the user to manually enter the date in a particular format. Values of quite a few controls which reside on that page are to be updated depending on the newly selected date and hence going to the server is a must.
I did try using the OnClientDateSelectionChanged property of the extender which lets me hook in my custom javascript, using which i was planning to trigger a postback but for some odd reason the function gets called only if the date is selected using an extender and not when manually edited (Hoping that it doesn't catch the click event over textbox's change).
Am sure many have tackled this issue before. Please do share. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就是这样,正如他们所说,保持简单。将文本框的AutoPostBack设置为true,并在服务器端捕获OnTextChanged事件。
Here it is, Keep It Simple as they say. Set AutoPostBack of the text box to true and capture the OnTextChanged event on the server side.