Click to See Complete Forum and Search --> : Deriving from Microsoft.Web.UI.WebControls.TreeView


rliq
October 20th, 2004, 10:38 PM
I derive my own class from TreeView so as I can add some extra functionality:

public class TimesheetTreeView : Microsoft.Web.UI.WebControls.TreeView
{
}

I add a TreeView control to my form and then edit then entry in the associated aspx.cs:

public class TSAdmin : System.Web.UI.Page
{
protected MyTreeView tvMine;

All other things being equal, I am now able to compile the code successfully. However, when I run the program, before the page is displayed, I recieve the following message:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The base class includes the field 'tvMine', but its type (TSAdmin.MyTreeView) is not compatible with the type of control (Microsoft.Web.UI.WebControls.TreeView).

Source Error:


Line 56: ...
Line 57: ...
Line 58: <iewc:treeview id="tvTMine" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 32px"
Line 59: runat="server" AutoPostBack="True"></iewc:treeview>
Line 60: ...

Source File: c:\inetpub\wwwroot\TSAdmin\TSAdmin.aspx Line: 58


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


Has anyone successfully derived there own class from TreeView?

rliq
October 21st, 2004, 11:45 PM
The original post had an error. The first code block should have read:

public class MyTreeView : Microsoft.Web.UI.WebControls.TreeView
{
}