So here's the situation. We have a TreeView control within an UpdatePanel that we use. Everything works in our current situation; expanding via the + triggers an Async postback or selecting the text/icon also triggers an Async postback.
In order to use this TreeView and its functionality elsewhere, I moved all the code into a UserControl. The problem is, after I did this the + or icon clicking does NOT trigger an Async postback, only clicking the text triggers an Async postback.
The markup looks like:
<asp:UpdatePanel id="Panel" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<uc1:MyTree id="myTreeViewUc" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<!-- Somewhere else on the page -->
<asp:UpdatePanel id="Panel2" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<!-- Stuff -->
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlId="myTreeViewUc" EventName="MyEvent" />
</Triggers>
</asp:UpdatePanel>
The MyEvent is raised like this (in the user control):
public event EventHandler MyEvent;
protected void Page_Load(object sender, EventArgs e)
{
this.MyTreeView.SelectedNodeChanged += OnNodeChanged;
this.MyTreeView.TreeNodePopulate += OnNodeChanged;
}
protected void OnNodeChanged() {
MyEvent(this, null); // raise custom event on node changed
}
If I got any syntax wrong, ignore it, it's pseudo code but it gets across what I am actually doing (raising the event on NodeChanged and Populate).
The current code we have simply does an AsyncPostBackTrigger on the MyTreeView control itself for SelectedNodeChanged.
TreeView code looks like:
<asp:TreeView ID="MyTreeView"
ShowExpandCollapse="true"
PopulateNodesFromClient="false"
ExpandDepth="0"
ShowLines="false"
runat="server">
</asp:TreeView>