SharePoint Web 部件和 Ajax
请,我是网络部件新手,我需要帮助!
我有一个我创建的自定义 Web 部件。 我使用 UpdatePanel 添加了 MS Ajax,效果很好。 我将所有控件添加到 CreateChildControls 方法中。 一旦我添加 UpdateProgress 控件,我的页面就会中断并出现以下错误:
在 PreRender 之前可能无法注册脚本控件
我没有像其他帖子建议的那样使用 OnPreRender 事件。 请,如果有人能给我建议,我将不胜感激。
谢谢
Please, I am new to webparts and I need help!!
I have a custom web part that I created. I added MS Ajax to it using an UpdatePanel which works fine. I add all my controls to the CreateChildControls method. As soon as I add a UpdateProgress control my page breaks with the following error:
Script controls may not be registered before PreRender
I do not use the OnPreRender event as what other posts suggest. Please, if anyone can give me advice it will be very much appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我之前遇到过类似的问题,尝试在 on init 方法重写中调用 EnsureChildControls 方法。 它应该由系统自动调用,但 sharepoint 喜欢时不时地忘记它。
像这样:
I encountered similar problem before, try to call EnsureChildControls method inside your on init method override. It should be called by system automatically, but sharepoint likes to forget about it from time to time.
Like this:
您可能忘记调用重写事件的基本方法,该事件不一定是 OnPreRender 事件。
检查 OnInit 或 OnLoad 事件是否正在调用其 base.On[...] 方法,例如:
You might have forgotten to call the base method of an overrided event, which is not necessarily the OnPreRender event.
Check if the OnInit or OnLoad events are calling their base.On[...] method, e.g.: