Solved

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

Posted on 2013-01-07
4
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

632 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