我正在使用一个更新面板,我在其中有一个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>
答案 0 :(得分:0)
需要将EventName更改为事件的名称而不是方法:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TreeView_Parent_Child" EventName="TreeNodePopulate" />
</Triggers>