Solved

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

Posted on 2013-01-07
4
240 Views
Last Modified: 2013-01-12
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
Comment
Question by:dyarosh
  • 3
4 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 38752608
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
 

Author Comment

by:dyarosh
ID: 38752678
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
 

Accepted Solution

by:
dyarosh earned 0 total points
ID: 38752726
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
 

Author Closing Comment

by:dyarosh
ID: 38769733
Found the problem on my own.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now