I cannot get C# to recognize the TreeView in VS help needed

N

needin4mation

Hi, I am using C# in asp.net. I have my treeview control from my built
..dll on my toolbox. I can drop it on the webpage. What I cannot do is
reference treeview objects from the codebehind form.

I can see:

protected Microsoft.Web.UI.WebControls.TreeView TreeView1;

But as soon as I try something like:

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
TreeView1 myNodeTopLevel = new TreeNode();
myNodeTopLevel.Text="Hello";
}
It doesn't recognize any of the object types. Compiling gives and
error that it doesn't know what TreeNode() is, etc. When I do the new
it gives no TreeView objects in the intellisense.

I know the control works because in the past I have used it with VB.NET
and Matrix (not in codebehind though). Any help is appreciated.
 
N

needin4mation

Sorry. I found I had to add this to my codebehind:

using Microsoft.Web.UI.WebControls;
 

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

Top