Please tell me if I am doing this treeview correctly. Thank you.

J

jm

<%@ Page Language="c#" autoeventwireup="false" %>
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<script runat="server">

void Page_load(object sender, EventArgs e) {


// Create the first TreeNode
TreeNode tvFirst = new TreeNode();
tvFirst.Text = "First Tree Node";

// Create the second TreeNode
TreeNode tvSecond = new TreeNode();
tvSecond.Text = "Second Tree Node";

// Add the second TreeNode as a child of the first
tvFirst.Nodes.Add(tvSecond);

// Add the first TreeNode to the TreeView's root TreeNodes
TreeView1.Nodes.Add(tvFirst);
}

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<iewc:TreeView id="TreeView1" runat="server">
<iewc:TreeNodeType></iewc:TreeNodeType>
</iewc:TreeView>
</p>
</form>
</body>
</html>


The page loads with no errors. I simply get nothing on the page
displayed. Is there some method I have to do so that I can see the
nodes I have added? I know treeview works on my system as I can hard
code nodes. Thank you.
 
M

Martin Dechev

Hi, jm,

Page_load should be Page_Load in C# because it is case-sensitive language.

Hope this helps
Martin
 
J

jm

Thanks.

I changed that and it still didn't work. I found that the line:

autoeventwireup="false"

has to be set to true or removed. I don't know if that's a bug or by design.
 
J

jm

It is fine. But what does it do that I can't do for free (and meet my
current needs)?
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top