Link to home
Start Free TrialLog in
Avatar of noulouk
noulouk

asked on

Namespace problem in my usercontrol

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.
Avatar of Chester_M_Ragel
Chester_M_Ragel

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
                }
}
Avatar of noulouk

ASKER

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 ?
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.
Avatar of noulouk

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Chester_M_Ragel
Chester_M_Ragel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial