• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1556
  • Last Modified:

User-defined namespace not recognized

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!

0
Howard Katz
Asked:
Howard Katz
1 Solution
 
hismightinessCommented:
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.
0
 
Howard KatzDatabase Report DeveloperAuthor Commented:
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.  
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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