Please help: Cannot inherit TreeView

Joined
Feb 14, 2004
Messages
11
Location
London
Hi guys,

Could someone please help - this is really getting me down...

I have been using the TreeView class in the Microsoft WebControls and now Ive tried to subclass it. I have:

Built and installed the .dll and everything required to get to use the TreeView in my pages.
Created a new Web Project in my solution.
Added a reference to the Microsoft.Web.UI.WebControls.dll in my projects \bin.
Put a
using Microsoft.Web.UI.WebControls;
line in my class.
Put the line
public class TreeRow : Microsoft.Web.UI.WebControls.TreeNode
in my code file TreeRow.cs.

As far as I know this is the correct thing to do. But, I am continuously getting the error:

Referenced class Core.TreeRow has base class or interface Microsoft.Web.UI.WebControls.TreeNode definaed in an assembly that is not referenced. You must add a reference to assembly Microsoft.Web.UI.WebControls.

What is really annoying me is that the References for that project DO have a reference to Microsoft.Web.UI.WebControls.

All I want to do is subclass TreeNode. Please help?


Best regards to all,
Matthew.
 
Strange, Im not sure what you are doing exactly but this works fine for me:

using System;
using Microsoft.Web.UI.WebControls;

namespace SamTest2
{

public class TestinTestin: Microsoft.Web.UI.WebControls.TreeNode
{
public TestinTestin(){}
}
}


*************************************
you might want to restart visual studio or create a new project, sounds like your solution may be corrupt or something.
 
Hi,

Thanx for your reply.

Would it be possible for you to post or mail a zipped solution which does this, please? Just something as simple as you have above, so that I can at least compare what Ive got with what should be done, please?

Thanks again,

Matthew.
 
I seem to have found some kind of reasoning.

Even when I created a whole new solution, copied the webcontrols dll into the bin and started from there I had problems. Indexes could not be found properly when adding to the tree view node lists etc.

In the end I removed the webcontrols from the toolbox. Created a whole new solution. Copied the webcontrols dll into the bin of the root project of the new solution. Added the webcontrols to the toolbox under a new name by referencing the new copy of the webcontrols dll.

I am now trying to build a new library based on inheritting the treenode class etc.

I hope this works...
 
Back
Top