user1511069
user1511069

Reputation: 339

Make sure that the class defined in this code file matches the 'inherits' attribute

**File :Views/Shared/Default.aspx:**

<%@ Page Language="C#" AutoEventWireup="True" CodeFile="Default.aspx.cs" Inherits="Views_Shared_Default" %>

File: Views/Shared/Default.aspx.cs:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


public partial class Views_Shared_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}



Error: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).
My Documents\Visual Studio 2008\Projects\3ICMS\Views\Shared\Default.aspx.cs 15 14 C:\...\3ICMS\


P.S I have 2 Default.aspx files in my Project 3ICMS.

1 File is at 3ICMS\Views\Shared\Default.aspx.cs 
2nd File is at 3ICMS\Default.aspx

I have tried creating a new file and copy paste this code..Didn't work. I have tried tried changing codefile to codebehind ... Didn't work

How to solve this problem?

Upvotes: 0

Views: 4376

Answers (1)

tsukimi
tsukimi

Reputation: 1645

The files are in different folders views and view , you should put the full directory path or put them in the same folder

<%@ Page Language="C#" AutoEventWireup="True" CodeFile="../../Views/Shared/Default.aspx.cs" Inherits="Views_Shared_Default" %>

Upvotes: 1

Related Questions