DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 11 Aug 2007 04:40:03 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    olduncleamos
          2    Alexey Smirnov
          3    olduncleamos
                 4    Mark Fitzpatrick
          5    Alexey Smirnov


Web site vs Web Project: scope difference?   
Hi all,

I am running into the following problem that I am just plain stuck.
Can't even find a starting point to look:

I originally had a "web site" created in VS2005. Within the site I
have a helper class (under the App_code directory) called PageHelper.
Within the class there are a bunch of static functions.

On most of the pages, I will have something like the following on the
HTML side:
<a href="<%# PageHelper.GetLocation() %>'>....

Now I am starting a Web Application project in VS2005 and thought I
would do something similar. But the above line is now giving me a
stubborn problem. The application will compile fine, but when I hit
the page, I will get an error message:
CS0103: The name 'PageHelper' does not exist in the current context

The code behind file have no problem calling the PageHelper class but
the inline code can't seem to see it. I have checked to make sure the
namespace is identical.

Any help will be greatly appreciated. I plain can't see a direction to
this problem.

Thanks in advance.
Date:Sat, 11 Aug 2007 04:40:03 -0000   Author:  

Re: Web site vs Web Project: scope difference?   
On Aug 11, 6:40 am, olduncleamos  wrote:

> Hi all,
>
> I am running into the following problem that I am just plain stuck.
> Can't even find a starting point to look:
>
> I originally had a "web site" created in VS2005. Within the site I
> have a helper class (under the App_code directory) called PageHelper.
> Within the class there are a bunch of static functions.
>
> On most of the pages, I will have something like the following on the
> HTML side:
> <a href="<%# PageHelper.GetLocation() %>'>....
>
> Now I am starting a Web Application project in VS2005 and thought I
> would do something similar. But the above line is now giving me a
> stubborn problem. The application will compile fine, but when I hit
> the page, I will get an error message:
> CS0103: The name 'PageHelper' does not exist in the current context
>
> The code behind file have no problem calling the PageHelper class but
> the inline code can't seem to see it. I have checked to make sure the
> namespace is identical.
>
> Any help will be greatly appreciated. I plain can't see a direction to
> this problem.
>
> Thanks in advance.


Maybe you need to define the namespace

Either try to add

<%@ Import Namespace="NSHERE" %>

or

<a href="<%# NSHERE.PageHelper.GetLocation() %>'>

Hope this helps
Date:Sat, 11 Aug 2007 08:17:49 -0000   Author:  

Re: Web site vs Web Project: scope difference?   
On Aug 11, 4:17 am, Alexey Smirnov  wrote:

> On Aug 11, 6:40 am, olduncleamos  wrote:
>
>
>
>
>
> > Hi all,
>
> > I am running into the following problem that I am just plain stuck.
> > Can't even find a starting point to look:
>
> > I originally had a "web site" created in VS2005. Within the site I
> > have a helper class (under the App_code directory) called PageHelper.
> > Within the class there are a bunch of static functions.
>
> > On most of the pages, I will have something like the following on the
> > HTML side:
> > <a href="<%# PageHelper.GetLocation() %>'>....
>
> > Now I am starting a Web Application project in VS2005 and thought I
> > would do something similar. But the above line is now giving me a
> > stubborn problem. The application will compile fine, but when I hit
> > the page, I will get an error message:
> > CS0103: The name 'PageHelper' does not exist in the current context
>
> > The code behind file have no problem calling the PageHelper class but
> > the inline code can't seem to see it. I have checked to make sure the
> > namespace is identical.
>
> > Any help will be greatly appreciated. I plain can't see a direction to
> > this problem.
>
> > Thanks in advance.
>
> Maybe you need to define the namespace
>
> Either try to add
>
> <%@ Import Namespace="NSHERE" %>
>
> or
>
> <a href="<%# NSHERE.PageHelper.GetLocation() %>'>
>
> Hope this helps- Hide quoted text -
>


Thanks so much! I added the <%@ Import Namespace... %> and it is
working now. I tried to full qualify the PageHelper class as you
suggested in the second option but that didn't work. Besides the page
class and the helper class are in the same namespace. I must be
missing something here.

Thanks again for your help.
Date:Sat, 11 Aug 2007 13:36:25 -0000   Author:  

Re: Web site vs Web Project: scope difference?   
The actual page designer surface though is not in the namespace you think it 
is. It's expected to be in the same namespace and class as the codebehind is 
since it's a partial class after all, but that's not exactly the case. You 
may notice in some of the runtime errors that you'll see a different 
classname that has the aspnet phrase in it. In other words, these other 
calls tend to run within their own space.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"olduncleamos"  wrote in message 
news:1186839385.888107.76760@d55g2000hsg.googlegroups.com...

> On Aug 11, 4:17 am, Alexey Smirnov  wrote:
>> On Aug 11, 6:40 am, olduncleamos  wrote:
>>
>>
>>
>>
>>
>> > Hi all,
>>
>> > I am running into the following problem that I am just plain stuck.
>> > Can't even find a starting point to look:
>>
>> > I originally had a "web site" created in VS2005. Within the site I
>> > have a helper class (under the App_code directory) called PageHelper.
>> > Within the class there are a bunch of static functions.
>>
>> > On most of the pages, I will have something like the following on the
>> > HTML side:
>> > <a href="<%# PageHelper.GetLocation() %>'>....
>>
>> > Now I am starting a Web Application project in VS2005 and thought I
>> > would do something similar. But the above line is now giving me a
>> > stubborn problem. The application will compile fine, but when I hit
>> > the page, I will get an error message:
>> > CS0103: The name 'PageHelper' does not exist in the current context
>>
>> > The code behind file have no problem calling the PageHelper class but
>> > the inline code can't seem to see it. I have checked to make sure the
>> > namespace is identical.
>>
>> > Any help will be greatly appreciated. I plain can't see a direction to
>> > this problem.
>>
>> > Thanks in advance.
>>
>> Maybe you need to define the namespace
>>
>> Either try to add
>>
>> <%@ Import Namespace="NSHERE" %>
>>
>> or
>>
>> <a href="<%# NSHERE.PageHelper.GetLocation() %>'>
>>
>> Hope this helps- Hide quoted text -
>>
>
> Thanks so much! I added the <%@ Import Namespace... %> and it is
> working now. I tried to full qualify the PageHelper class as you
> suggested in the second option but that didn't work. Besides the page
> class and the helper class are in the same namespace. I must be
> missing something here.
>
> Thanks again for your help.
>
>
>
> 
Date:Sat, 11 Aug 2007 09:17:09 -0500   Author:  

Re: Web site vs Web Project: scope difference?   
On Aug 11, 3:36 pm, olduncleamos  wrote:

> On Aug 11, 4:17 am, Alexey Smirnov  wrote:
>
>
>
>
>
> > On Aug 11, 6:40 am, olduncleamos  wrote:
>
> > > Hi all,
>
> > > I am running into the following problem that I am just plain stuck.
> > > Can't even find a starting point to look:
>
> > > I originally had a "web site" created in VS2005. Within the site I
> > > have a helper class (under the App_code directory) called PageHelper.
> > > Within the class there are a bunch of static functions.
>
> > > On most of the pages, I will have something like the following on the
> > > HTML side:
> > > <a href="<%# PageHelper.GetLocation() %>'>....
>
> > > Now I am starting a Web Application project in VS2005 and thought I
> > > would do something similar. But the above line is now giving me a
> > > stubborn problem. The application will compile fine, but when I hit
> > > the page, I will get an error message:
> > > CS0103: The name 'PageHelper' does not exist in the current context
>
> > > The code behind file have no problem calling the PageHelper class but
> > > the inline code can't seem to see it. I have checked to make sure the
> > > namespace is identical.
>
> > > Any help will be greatly appreciated. I plain can't see a direction to
> > > this problem.
>
> > > Thanks in advance.
>
> > Maybe you need to define the namespace
>
> > Either try to add
>
> > <%@ Import Namespace="NSHERE" %>
>
> > or
>
> > <a href="<%# NSHERE.PageHelper.GetLocation() %>'>
>
> > Hope this helps- Hide quoted text -
>
> Thanks so much! I added the <%@ Import Namespace... %> and it is
> working now. I tried to full qualify the PageHelper class as you
> suggested in the second option but that didn't work. Besides the page
> class and the helper class are in the same namespace. I must be
> missing something here.
>
> Thanks again for your help.- Hide quoted text -
>
> - Show quoted text -


BTW, the right syntax is

<a href="<%= NSHERE.PageHelper.GetLocation() %>">

"<%=" equals to Response.Write and href must be closed with ( " )
Date:Sat, 11 Aug 2007 15:01:12 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us