Groups | Blog | Home
all groups > asp.net webcontrols > september 2006 >

asp.net webcontrols : No Render on Treeview event


Tim.Forbess NO[at]SPAM gmail.com
9/18/2006 7:19:37 AM
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>
Tim.Forbess NO[at]SPAM gmail.com
9/18/2006 7:50:28 AM
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!
AddThis Social Bookmark Button