[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Namespace problem in my usercontrol

Posted on 2004-09-29
5
Medium Priority
?
217 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
[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
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Chester_M_Ragel
ID: 12187152
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
ID: 12187966
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
ID: 12188159
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
ID: 12188197
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 2000 total points
ID: 12188227
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

650 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