Treeview event

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>
 
T

Tim.Forbess

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top