Solved

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

Posted on 2013-01-07
4
244 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 75

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

713 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