Treeview event

  • Thread starter Thread starter Tim.Forbess
  • Start date Start date
T

Tim.Forbess

During a postback event from the treeview control I try to update a
label's text. The code is called in the event handler for
OnTreeNodePopulate but the label text isn't updated when the page
returns. Below is the sample code. Ideas?
--------------------------------

<%@ Page Language="C#" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
}

public void OnPopulate(Object sender, TreeNodeEventArgs e)
{
MessageLabel.Text = "populating";
}
</script>

<html>
<head runat="server"><title>Test</title></head>
<body>
<form id="form1" runat="server"><div>
<asp:TreeView ID="TreeControl" runat="server"
OnTreeNodePopulate="OnPopulate">
<Nodes>
<asp:TreeNode Text="Root" Expanded="False"
PopulateOnDemand="true"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:Label ID="MessageLabel" runat="server"
Text=""></asp:Label>
</div></form>
</body>
</html>
 
The answer seems to be that this treeview event is an "out of band"
request. An out of band request obtains additional data, without
posting the entire page. Therefore only the treeview is updated.

This is fine, but it would have been nice to know in the documentation
for the event!
 
Back
Top