Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

The type name 'CVL' does not exist in the type 'CVL.CVL Error

I am trying to access a public method in my Master Page from my child pages.  Here is the basic layout that I have:

CVL.Master - Master page
CVL.Master.cs
============
namespace CVL
{
    public partial class CVL : System.Web.UI.MasterPage
    {
            public void ErrorHandling(parameter definitions)
            {
                     error handling code
            }
    }
}

CVLLookup.aspx - Web page using CVL.Master as it's Master Page
CVLLookup.aspx.cs
===============
namespace CVL
{
    public partial class CVLLookup : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs, e)
        {
             CVL pm = (CVL)Page.Master;
             pm.ErrorHandling(parameters);
        }
    }
}

Open in new window


I get the above error in the CVLLookup.aspx.designer.cs file which is autogenerated.  Here is what is generated in the designer file:

public new CVL.CVL Master {
    get {
        return ((CVL.CVL)(base.Master));
    }
}

The error occurs on the second reference to CVL.CVL in both places.  See attached file.

Any help is greatly appreciated!
CVLError.bmp
0
dyarosh
Asked:
dyarosh
  • 3
1 Solution
 
käµfm³d 👽Commented:
Remove one of the "CVLs":

public new CVL Master {
    get {
        return ((CVL)(base.Master));
    }
}

Open in new window


Out of curiosity, why are you using new?
0
 
dyaroshAuthor Commented:
I am using VS2010 and the .designer file is auto-generated.  I did not create this definition explicitly.  It was done by VS2010 for me so I can't make any changes to it.
0
 
dyaroshAuthor Commented:
I finally found the problem.  I had the following statement in my .aspx page:

<%@ MasterType VirtualPath="~/CVL.Master" %>

I thought I needed that to access the methods in the master page.  I removed it and now I am able to build without any errors.
0
 
dyaroshAuthor Commented:
Found the problem on my own.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now