从 Javascript 弹出日历行为
如何在页面中嵌入 CalendarBehavior 所需的所有脚本,而不实际使用服务器端控件 (CalendarExtender)。我无法使用服务器端扩展程序的原因是我的页面可能包含数百个日期控件;我希望能够根据需要延迟加载日历(当用户单击控件时)。
从 javascript 创建日历的代码如下:
cal = $create(AjaxControlToolkit.CalendarBehavior,
{ 'id': owner.id + '_calendar', 'cssClass': 'calExt', 'format': format },
null, null, owner);
问题是,如果不包含 AjaxControlToolkit 资源中所需的所有 js,它将抛出错误:
AjaxControlToolkit is undefined.
非常感谢,
Florin S。
How can I embbed all the scripts needed by the CalendarBehavior in a page, without actually using the server-side control (CalendarExtender). The reason I can't use a server side extender is that I have a page with, possibly, hundreds of Date controls; I want to be able lazy-load the calendars as needed (when the user clicks in the control).
The code that creates the calendar from javascript is the following:
cal = $create(AjaxControlToolkit.CalendarBehavior,
{ 'id': owner.id + '_calendar', 'cssClass': 'calExt', 'format': format },
null, null, owner);
The problem is that without including all the needed js from the AjaxControlToolkit resources, it will throw the error:
AjaxControlToolkit is undefined.
Thank you very much,
Florin S.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了以下 hack,它将注册 CalendarExtender 公开的所有脚本和 css 引用。我认为该解决方案是通用的,因此可以与其他扩展器一起使用:
RegisterCssReferences 调用需要临时扩展器实例,否则会引发错误。
它有效,但是 YMMV。
I've found the following hack that will register all the scripts and css references exposed by the CalendarExtender. I think the solution is generic so that it can be used with other extenders:
The temporary extender instance is needed for the RegisterCssReferences call, otherwise it will throw an error.
It works, but YMMV.
我有同样的问题。
我发现,在 javascript-land 中,您应该使用
Sys.Extended.UI
而不是AjaxControlToolkit
。因此,
您可以这样做:
I had the same issue.
I found that, in javascript-land, instead of
AjaxControlToolkit
you should useSys.Extended.UI
.So, instead of:
you do this: