By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,799 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,799 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sorry. I found I had to add this to my codebehind:

using Microsoft.Web.UI.WebControls;

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.