![]() |
|
|
|||||||
![]() |
ASP Net - Newbie - 2 classes in the same namespace problem |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
I'm new to VS2005, but have experience with previous versions.
I created web site with a page and a web user control inserted in it. Their classes are in the same namespace. Here's the code fragment: namespace NmSp { public partial class Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } } namespace NmSp { public partial class wuc : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { NmSp.Test t = (NmSp.Test)Page; // <------ } } } Why do I get compile time error that Test does not exitst in namespace NmSp? Wojtek Jarma |
|
|
|
|
#2 |
|
Posts: n/a
|
There's two ways around this that I know of. One is to create a base
page class for the code behind class that you want to reference and insert it into the app_code folder and then reference that. The other is to switch and use the .net web application project format. You'll have to download the update here: http://msdn.microsoft.com/asp.net/re...p/default.aspx Jarma wrote: > I'm new to VS2005, but have experience with previous versions. > I created web site with a page and a web user control inserted in it. > Their classes are in the same namespace. > > Here's the code fragment: > > namespace NmSp > { > public partial class Test : System.Web.UI.Page > { > protected void Page_Load(object sender, EventArgs e) > { > } > } > } > > > namespace NmSp > { > public partial class wuc : System.Web.UI.UserControl > { > protected void Page_Load(object sender, EventArgs e) > { > NmSp.Test t = (NmSp.Test)Page; // <------ > } > } > } > > Why do I get compile time error that Test does not exitst in namespace NmSp? > > Wojtek wfairl@gmail.com |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dial Up Problem | smackedass | A+ Certification | 3 | 02-02-2007 11:59 PM |
| NEWBIE - DVD burn problem - need help | Vic Baron | DVD Video | 6 | 09-29-2005 10:56 PM |
| Re: Virus Problem ** Help!** | David BlandIII | A+ Certification | 1 | 03-02-2004 06:00 PM |
| Re: Serious Computer Problem | hootnholler | A+ Certification | 1 | 11-24-2003 12:18 PM |
| Re: Serious Computer Problem | Bret | A+ Certification | 0 | 11-19-2003 12:51 AM |