Solved

Namespace problem in my usercontrol

Posted on 2004-09-29
5
209 Views
Last Modified: 2010-04-15
Hi Experts,

Here is the problem:

namespace MyDirectory.UserControls.MyDirectory.File
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Web.UI.WebControls;

public class NewFile : System.Web.UI.UserControl
     {
... code
                }
}

In my Asp .Net UserControl, if in the code, I want to use my other namespace like MyDirectory.MyDirectory.OtherNameSpace, then Visual Studio debugger tells me the namespace is unknown and I can only access to UserControls.MyDirectory.
The 2 namespaces MyDirectory.UserControls.MyDirectory shadows MyDirectory.MyDirectory. Why ?

How to use this namespace without any namespace title modify ?

Thanks in advance for your help. Hope I was clear.

Note that outside the usercontrol namespace, I can use both.
0
Comment
Question by:noulouk
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Chester_M_Ragel
Comment Utility
Try,

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Web.UI.WebControls;
using MyDirectory.MyDirectory.OtherNameSpace;

namespace MyDirectory.UserControls.MyDirectory.File
{
public class NewFile : System.Web.UI.UserControl
     {
... code
                }
}
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
Thanks Chester_M_Ragel,

I already try this and works well outside the code.
But if I want to use it inside the code the first MyDirectory is UserControls.MyDirectory namespace ?????????? (ie Visual Studio hover menu) .
Is this a Visual Studio bug ?
0
 
LVL 6

Expert Comment

by:Chester_M_Ragel
Comment Utility
Its actually not related with VS.Net. Its with .net Framework. Thats how it works.  B'cos of the nesting of MyDirectory and how .net interprets it, you can't reffer it like that.
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
Is there another way to do what I want or have I to change my namespace name ? If yes, hope framework 2.0 will solve this bug.
0
 
LVL 6

Accepted Solution

by:
Chester_M_Ragel earned 500 total points
Comment Utility
I'm not sure about other ways.. I'll recommend to use some other namespace. Also, In .Net FW beta 2.0 its the same:(
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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