D
drop
Hi,
I'm currently working with the Treeview control in ASP .Net 2.0. The
tree is filled dynamically based on data contained in a MySQL Database.
Here is the exact behavior I want :
1 - User clicks on a node to expand it.
2 - Add a child node to the node clicked by the user saying the tree is
loading that part. So here, I also need to expand the node clicked by
the user.
3 - Send a request to the server to populate the node clicked by the
user.
4 - When the request comes back, update only the part of the treeview
that needs updating, I don't want to reload the whole page.
Currently, I'm able to get behavior 1, 3 and 4 by using the built-in
features of the Treeview, but I'm having problem with 2. Here is the
code I'm using for the treeview :
<asp:TreeView ID="InventoryTreeView" runat="server" ExpandDepth="1"
OnTreeNodePopulate="PopulateNode"
OnSelectedNodeChanged="SelectNodeChanged"
EnableClientScript="true"
PopulateNodesFromClient="true" ImageSet="Simple" NodeIndent="10"
ShowLines="True">
<Nodes>
<asp:TreeNode Text="Inventory" Value="Root"
Expanded="True">
<asp:TreeNode Text="Adventure"
Value="Adventure" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Cruise"
Value="Cruise" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Resort"
Value="Resort" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Tour" Value="Tour"
PopulateOnDemand="True"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
Does anyone has any hint on how I could make #2 happen, even if it
means rewriting the code used to make the other points work?
I tough of a solution but I'm one step short of doing it. I could use
the TreeNodePopulate events to add the loading node I need in step 2.
What I'm unable to figure out is how to send back another message to
the server to make the real node population from there. Anyone has any
idea on the event I could use to make that? I already tried using the
TreeNodeExpanded event, but that doesn't work.
Thanks
I'm currently working with the Treeview control in ASP .Net 2.0. The
tree is filled dynamically based on data contained in a MySQL Database.
Here is the exact behavior I want :
1 - User clicks on a node to expand it.
2 - Add a child node to the node clicked by the user saying the tree is
loading that part. So here, I also need to expand the node clicked by
the user.
3 - Send a request to the server to populate the node clicked by the
user.
4 - When the request comes back, update only the part of the treeview
that needs updating, I don't want to reload the whole page.
Currently, I'm able to get behavior 1, 3 and 4 by using the built-in
features of the Treeview, but I'm having problem with 2. Here is the
code I'm using for the treeview :
<asp:TreeView ID="InventoryTreeView" runat="server" ExpandDepth="1"
OnTreeNodePopulate="PopulateNode"
OnSelectedNodeChanged="SelectNodeChanged"
EnableClientScript="true"
PopulateNodesFromClient="true" ImageSet="Simple" NodeIndent="10"
ShowLines="True">
<Nodes>
<asp:TreeNode Text="Inventory" Value="Root"
Expanded="True">
<asp:TreeNode Text="Adventure"
Value="Adventure" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Cruise"
Value="Cruise" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Resort"
Value="Resort" PopulateOnDemand="True"></asp:TreeNode>
<asp:TreeNode Text="Tour" Value="Tour"
PopulateOnDemand="True"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
Does anyone has any hint on how I could make #2 happen, even if it
means rewriting the code used to make the other points work?
I tough of a solution but I'm one step short of doing it. I could use
the TreeNodePopulate events to add the loading node I need in step 2.
What I'm unable to figure out is how to send back another message to
the server to make the real node population from there. Anyone has any
idea on the event I could use to make that? I already tried using the
TreeNodeExpanded event, but that doesn't work.
Thanks