User-defined namespace not recognized

Posted on 2007-10-12
Last Modified: 2012-06-27
Hello, experts!

I created some user controls for my ASP.NET 2.0 web site.  They live in UserControls folder, and each one has a line like this at the top of the .ASCX file

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="dropdownlist.ascx.vb" Inherits="QuoteUserControls.UserControls_dropdownlist" %>

and the codebehind looks like this:

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace QuoteUserControls
    Partial Class UserControls_dropdownlist
        Inherits System.Web.UI.UserControl
[... Some public and private properties and methods]
    End Class
End Namespace

For some reason the namespace QuoteUserControls is sometimes not recognized in the master page.  I need to close Visual Studio and reopen it to get it to compile after I make a code change.  Right now I have tried this approach multiple times, but it's not working.  This namespace is recognized in other ASPX pages, just not in master.vb.  Anyone have any ideas what's wrong?  Thanks for your help!

Question by:katzhoward
    LVL 9

    Accepted Solution

    Check your import statements in the master codebehind, and the other files and make sure they are synch'd up.  Also, if you are using the full version of VS.Net, I would suggest checking to see what namespaces you are already importing and see if there is a conflict between those in the project settings and those imported explicitly in the master.vb file.  I have seen this a lot in projects where two namespace structures are similar.  For example: Microsoft.Web.UI.WebControls.Label and MyNamespace.Web.UI.WebControls.Labe.

    Author Comment

    Thanks for your reply!  The problem wasn't with the namespace.  I finally had to @Register each of the user controls in my master page.  I thought registering them in the web.config was supposed to eliminate the necessity for the @Register statement in each aspx page, but it doesn't seem to work in my project.  I got rid of the namespace since it wasn't necessary.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    759 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

    9 Experts available now in Live!

    Get 1:1 Help Now