CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Deriving from Microsoft.Web.UI.WebControls.TreeView

    I derive my own class from TreeView so as I can add some extra functionality:

    Code:
    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:

    Code:
    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:


    Code:
    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?
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: Deriving from Microsoft.Web.UI.WebControls.TreeView

    The original post had an error. The first code block should have read:

    Code:
    public class MyTreeView : Microsoft.Web.UI.WebControls.TreeView
    {
    }
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured