CalendarExtender 使用 Javascript 更改日期
我的页面上有一个 CalendarExtender 控件,有时必须将日期更改为下一个周日。 我当前正在使用控件的 OnClientDateSelectionChanged 属性来调用一个函数,该函数将在日期中添加一些天数,直到周日。
我遇到的问题是,如果我在日历中选择星期二,文本框将显示下一个星期日,但日历中选定的日期仍然是星期二。
如何更新 CalendarExtender 以获取我在 javascript 中选择的新日期? CalendarExtendar 连接的文本框显示正确的日期...
I have a CalendarExtender control on my page and sometimes have to change the date to the next occuring Sunday. I'm currently using the OnClientDateSelectionChanged property of the control to call a function that will add some days to the date until its Sunday.
The problem I'm having is that if I select a Tuesday in my calendar, the textbox will display the next Sunday but the selected date in the calendar is still Tuesday.
How do I update the CalendarExtender to have the new date that has one I selected in javascript? The textbox the CalendarExtendar is connected to shows the correct date...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
,则更改 CalendarExtender 的 TargetControlId 文本框的值会影响所选日期:
控件的
set_selectedDate()
函数,这一调用不仅会设置 Calendar 上的选定内容。同时在目标文本框中显示以下示例代码:
Changing the value of the textbox that is the TargetControlId for the CalendarExtender affects the selected date if the following 2 conditions are met:
That being said, the correct way to handle this is to call the
set_selectedDate()
function of the CalendarExtender control. This one call, not only sets the selected on the Calendar, but also on the Targeted textbox at the same time.Here's the example code: