noulouk
asked on
Namespace problem in my usercontrol
Hi Experts,
Here is the problem:
namespace MyDirectory.UserControls.M yDirectory .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.WebContro ls;
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.Ot herNameSpa ce, then Visual Studio debugger tells me the namespace is unknown and I can only access to UserControls.MyDirectory.
The 2 namespaces MyDirectory.UserControls.M yDirectory 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.
Here is the problem:
namespace MyDirectory.UserControls.M
{
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.WebContro
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.Ot
The 2 namespaces MyDirectory.UserControls.M
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.
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 ?
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.WebContro
using MyDirectory.MyDirectory.Ot
namespace MyDirectory.UserControls.M
{
public class NewFile : System.Web.UI.UserControl
{
... code
}
}