nsfranklin
asked on
Treeview PopulateOnDemand fails
Hi
Can someone tell me why I cannot get this to work. The populate on demand function does not trigger
Here is the aspx code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
VerticalPadding="0px" />
<Nodes>
<asp:TreeNode Text="Available devices" Value="0" PopulateOnDemand="True"></ asp:TreeNo de>
</Nodes>
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
</div>
</form>
</body>
</html>
Here is the Code behind.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub TreeView1_TreeNodePopulate (ByVal sender As Object, ByVal e As TreeNodeEventArgs)
Select Case e.Node.Depth
Case 0
Response.Write(e.Node)
Exit Sub
Case 1
Response.Write(e.Node)
Exit Sub
End Select
End Sub
any help would be appreciated. Thanks
Can someone tell me why I cannot get this to work. The populate on demand function does not trigger
Here is the aspx code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
VerticalPadding="0px" />
<Nodes>
<asp:TreeNode Text="Available devices" Value="0" PopulateOnDemand="True"></
</Nodes>
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
</div>
</form>
</body>
</html>
Here is the Code behind.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub TreeView1_TreeNodePopulate
Select Case e.Node.Depth
Case 0
Response.Write(e.Node)
Exit Sub
Case 1
Response.Write(e.Node)
Exit Sub
End Select
End Sub
any help would be appreciated. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
Further to the above, my error, problem solved and points awarded for guidance.
Thanks
Further to the above, my error, problem solved and points awarded for guidance.
Thanks
ASKER
Thanks for that, new code is
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" action="Default.aspx" runat="server">
<div>
<asp:TreeView ID="TreeView1" SkinId="Simple" Width="250" ExpandDepth="0" runat="server" AutoGenerateDataBindings="
<Nodes>
<asp:TreeNode Text="Inventory" SelectAction="SelectExpand
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
</form>
</body>
</html>
Code behind is
Protected Sub TreeView1_TreeNodePopulate
Select Case e.Node.Depth
Case 0
Response.Write(e.Node.ToSt
Exit Sub
Case 1
Response.Write(e.Node.ToSt
Exit Sub
End Select
End Sub
Why can I only click on the node once to trigger the treenodepopulate, the page re-displays with the + missing and subsequent clicks to not show a response.