[英]UpdatePanel Trigger Error. Could not find an event on associated control for the trigger in UpdatePanel
[英]Event not associated on control error while using updatepanel
我正在使用其中具有Treeview控件的更新面板。 我写了一个异步触发器。 我遇到了一个我第一次无法解决的错误。 我在更新面板中的控件中也遇到了此错误,但由于我使用$
分隔父级和子级而得到解决。 现在我在查找事件名称时遇到问题。 以下是我的错误
Could not find an event named 'PopulateNode' on associated control 'TreeView_Parent_Child' for the trigger in UpdatePanel '_updatepnlTreeview'.
我的代码是
<asp:Panel ID="Panel1" Visible="true" runat="server"
ScrollBars="Auto">
<div style="overflow: auto; height: 400px; width:230px; border-right: solid; border-right-color: gray">
<asp:UpdatePanel ID="_updatepnlTreeview" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:TreeView ID="TreeView_Parent_Child" EnableClientScript="true" align="left"
AutoGenerateDataBindings="true" LeafNodeStyle-ForeColor="Black" NodeStyle-ForeColor="Black"
PopulateNodesFromClient="true" runat="server" Font-Names="Arial"
OnTreeNodePopulate="PopulateNode"
HoverNodeStyle-BackColor="ActiveBorder" Font-Size="Small" ImageSet="Arrows" NodeStyle-HorizontalPadding="5px">
<HoverNodeStyle Font-Bold="true" BackColor="Beige" />
<Nodes>
</Nodes>
<NodeStyle ForeColor="Black" />
<LeafNodeStyle ForeColor="Black" />
</asp:TreeView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TreeView_Parent_Child" EventName="PopulateNode" />
</Triggers>
</asp:UpdatePanel>
</div>
</asp:Panel>
需要将EventName更改为事件的名称,而不是方法:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TreeView_Parent_Child" EventName="TreeNodePopulate" />
</Triggers>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.