UpdatePanel 让我发疯 - 动态创建的 UpdatePanel 问题

发布于 2024-07-16 03:08:47 字数 773 浏览 3 评论 0原文

因此,我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

↙厌世 2024-07-23 03:08:47

尝试在此 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文