UpdatePanel 让我发疯 - 动态创建的 UpdatePanel 问题
因此,我在 Page_Load 中有以下代码:
updDesignations = new UpdatePanel();
updDesignations.ContentTemplateContainer.Controls.Add(toutLineDesignation);
updDesignations.ChildrenAsTriggers = true;
updDesignations.UpdateMode = UpdatePanelUpdateMode.Always;
divDesignations.Controls.AddAt(0,updDesignations);
当我单击此动态创建的更新面板中的链接按钮时,将在服务器上调用适当的事件处理程序。 但是,所做的任何更改都不会保留回客户端,并且来自更新面板 AJAX 调用的 HTTP 响应始终为空:
请求格式正确,并且包含正确的表单提交信息,响应很简单:
Server Microsoft-IIS/5.1
Date Tue, 07 Apr 2009 22:30:57 GMT
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Cache-Control no-cache, no-store
Pragma no-cache
Expires -1
Content-Length 0
This is moving我疯了,因为这必须是动态创建的更新面板。 我究竟做错了什么?
So, I have the following code in Page_Load:
updDesignations = new UpdatePanel();
updDesignations.ContentTemplateContainer.Controls.Add(toutLineDesignation);
updDesignations.ChildrenAsTriggers = true;
updDesignations.UpdateMode = UpdatePanelUpdateMode.Always;
divDesignations.Controls.AddAt(0,updDesignations);
When I click on a Linkbutton within this dynamically created update panel, the appropriate event handler is called on the server. However, any changes made are not persisted back to the client, and the HTTP response from the update panel AJAX call is always empty:
The request is properly formed, and includes the correct form submission information, the response is simply this:
Server Microsoft-IIS/5.1
Date Tue, 07 Apr 2009 22:30:57 GMT
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Cache-Control no-cache, no-store
Pragma no-cache
Expires -1
Content-Length 0
This is driving me nuts, as this has to be a dynamicly created update panel. What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在此 UpdatePanel 上设置 ID。 当 UpdatePanel 没有 ID 时,他们会生气。 我已经和他们解决了很多奇怪的问题,只要确保他们有身份证即可。
Try setting an ID on this UpdatePanel. UpdatePanels get angry when they don't have an ID. I have solved many a weird problem with them just be ensuring they have an ID.