Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Newbie - 2 classes in the same namespace problem

 
Thread Tools Search this Thread
Old 08-02-2006, 04:43 PM   #1
Default Newbie - 2 classes in the same namespace problem


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
  Reply With Quote
Old 08-02-2006, 09:29 PM   #2
wfairl@gmail.com
 
Posts: n/a
Default Re: Newbie - 2 classes in the same namespace problem
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46