ChildrenAsTriggers updatePanel 在数据库保存后未更新
您好,
我有一个页面在 Web 部件中加载 userEvents
(即墙帖或个人资料更新),然后将该 Web 部件注册到评论页面上,然后该人添加我们需要的墙评论更新保存 Web 部件的 updatepanel
。我们无法将文本框
和按钮
添加到Web部件,因为它是在网站其他部分发布的“阅读器”。因此,当用户添加墙贴时,它会保存到数据库并将 UserEvent
加载到数据库的不同部分,之后需要更新 UpadatePanel
持有UserEvent
Reader Web 部件。我已经阅读过,我认为我们的解决方案是使用 ChildrenAsTriggers
。
我们将不胜感激您的帮助。
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<asp:TextBox ID="txtAddWallPost" CssClass="multilinetextbox" MaxLength="200" runat="server"
TextMode="MultiLine"></asp:TextBox>
<br />
<div class="buttons">
<asp:Button ID="btnButtonWallPost" runat="server" OnClick="btnButtonWallPost_Click">
</asp:Button>
</div>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="False" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<uc1:UserEventsWebPart ID="UserEventsWebPart1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
我希望我说得够清楚了:P
Peter
Greetings,
I have a page that loads userEvents
(Ie a wall post or profile update) in a webpart, this webpart is then registered onto a comment page, so then the person adds a wall comment we need to update the updatepanel
that holds the web part. We cannot add the textbox
and button
to the webpart as it is a "reader" that issued on other parts of the site. So when the person adds a wall post it saves to the DB and loads a UserEvent
into a different section to the DB, after this has happened to need to update the UpadatePanel
holding the UserEvent
Reader webpart. Ive read up and I think our solution is to use ChildrenAsTriggers
.
Your help will be appreciated.
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<asp:TextBox ID="txtAddWallPost" CssClass="multilinetextbox" MaxLength="200" runat="server"
TextMode="MultiLine"></asp:TextBox>
<br />
<div class="buttons">
<asp:Button ID="btnButtonWallPost" runat="server" OnClick="btnButtonWallPost_Click">
</asp:Button>
</div>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="False" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<uc1:UserEventsWebPart ID="UserEventsWebPart1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
I hope I made this clear enough :P
Peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,当用户点击“btnButtonWallPost”按钮时,您希望更新 UpdatePanel1 中的内容吗?
如果我确实理解你的意思,那么我对你的设置有点困惑。为什么需要内部 UpdatePanel?单击按钮时,所有内容都应该更新。这将导致外部 UpdatePanel 的更新,进而更新内部 UpdatePanel。
是的,我相信在外部 UpdatePanel 上设置 ChildrenAsTriggers 应该可以解决问题(尽管我相信它默认设置为 true)。
If I understand you correctly, when a user hits the "btnButtonWallPost" button, you want the content within UpdatePanel1 to be updated?
If I do understand you correctly, then I'm a little confused by your set up. Why do you need the inner UpdatePanel? Everything should be updated when the button is clicked. That'll cause an update of the outer UpdatePanel which will in turn, update the inner UpdatePanel.
And yes, I believe setting ChildrenAsTriggers on the outer UpdatePanel should do the trick (although I believe it's set to true by default anyway).