CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    405

    Error: Make sure that the class defined in this code file matches the 'inherits' attr

    The website is working fine now I added MenuLeft.ascx into the folder "C:\WebSite2010\WebMaster\Controls" when pressing the Rebuild website button with the error "Error: C:\WebSite2010\WebMaster\Controls\MenuTop.ascx.cs(14): error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)". Note that the folder "C:\WebSite2010\Controls" already has a file with the same file name: MenuLeft.ascx now I copy the declaration of 2 files with the same name, how do I change the code ?

    Code:
    in the file: C:\WebSite2010\Controls\MenuLeft.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuLeft.ascx.cs" Inherits="MenuLeft" %>
    <%@ Import Namespace="webapp4U" %>
    <%@ Register Src="~/Controls/ThuvienHinhAnh.ascx" TagPrefix="uc" TagName="ThuvienHinhAnh" %>
    <%@ Register Src="~/Controls/QuangCaoLeft.ascx" TagPrefix="uc" TagName="QuangCaoLeft" %>
    <%@ Register Src="~/Controls/WebURL.ascx" TagPrefix="uc" TagName="WebURL" %>
    <%@ Register Src="~/Controls/Newsletter.ascx" TagPrefix="uc" TagName="Newsletter" %>
    <%@ Register src="DanhMucBDS.ascx" tagname="DanhMucBDS" tagprefix="uc" %>
    <%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>
    <table cellspacing="0" cellpadding="0" width="180" border="0">
    ...
    </table>
    in the file: C:\WebSite2010\WebMaster\Controls\MenuLeft.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuLeft.ascx.cs" Inherits="MenuLeft" %>
    <%@ Import Namespace="webapp4U" %>
    <table width="185px" border="0" cellpadding="0" cellspacing="0">
    ...
    </table>

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Error: Make sure that the class defined in this code file matches the 'inherits'

    Where is the MenuLeft.ascx.cs file?

  3. #3
    Join Date
    Sep 2007
    Posts
    405

    Re: Error: Make sure that the class defined in this code file matches the 'inherits'

    file located:

    C:\WebSite2010\Controls\MenuLeft.ascx
    C:\WebSite2010\WebMaster\Controls\MenuLeft.ascx

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Error: Make sure that the class defined in this code file matches the 'inherits'

    Quote Originally Posted by dongtrien View Post
    file located:

    C:\WebSite2010\Controls\MenuLeft.ascx
    C:\WebSite2010\WebMaster\Controls\MenuLeft.ascx
    Not the file I asked for. Where is the MenuLeft.ascx.cs file?

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