467,920 Members | 1,239 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

Accessing shared properties in a pge

WFB
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page (class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls). However,
in 2.0 this functionality seems to have dissapeard. Is there any way to get
to this, or a reccomended altenate approach?

Thanks
Joe
Nov 19 '05 #1
  • viewed: 918
Share:
9 Replies
Rather than attaching the method to the page, it might make more sense to
create a Utility class and add the method there.

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there any
way to get to this, or a reccomended altenate approach?

Thanks
Joe

Nov 19 '05 #2
Just add a new class, and mark the property shared.

I just got the kb alert a minute ago, which makes me think this may not be a
good idea. I've been doing this myself for a long time. <eek>

http://www.kbalertz.com/Feedback_893666.aspx

Greg
"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there any
way to get to this, or a reccomended altenate approach?

Thanks
Joe

Nov 19 '05 #3
not with the ease.

when you run the wizard, it will create new class file in the appcode dir
that has this static method, and then change the page to inherit from it.
this will be great for your old pages, but a pain when you add new ones.

this comes about because in version 1, all the codebehinds went into 1 dll,
so they could reference each other, in 2.0 they go into seperate dlls (1 per
page), and app_code (1 dll for the dir) is where the shared code is.
-- bruce (sqlwork.com)
"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there any
way to get to this, or a reccomended altenate approach?

Thanks
Joe

Nov 19 '05 #4
WFB
In general, how are other people handling this (in 1.1 and 2.0)? Just
hardcoding the links?

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there any
way to get to this, or a reccomended altenate approach?

Thanks
Joe


Nov 19 '05 #5
> Just add a new class, and mark the property shared.

Sounds like it is not so simply in ASP.NET 2.0 anymore. ?? :(

"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:eb*************@TK2MSFTNGP15.phx.gbl...
Just add a new class, and mark the property shared.

I just got the kb alert a minute ago, which makes me think this may not be
a good idea. I've been doing this myself for a long time. <eek>

http://www.kbalertz.com/Feedback_893666.aspx

Greg
"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there
any way to get to this, or a reccomended altenate approach?

Thanks
Joe


Nov 19 '05 #6
Implement a singleton pattern class and add this methods to this class, my
advice is.

But anyway, links are external resources therefore can be stored in Resx
file. This would help you integrate your modules/pages with other
applications.

--
HTH

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET

"WFB" <x@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In general, how are other people handling this (in 1.1 and 2.0)? Just
hardcoding the links?

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there
any
way to get to this, or a reccomended altenate approach?

Thanks
Joe


Nov 19 '05 #7
WFB
Thanks. Do you have an example?

"Yunus Emre ALP÷ZEN [MCSD.NET]" <yemre> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
Implement a singleton pattern class and add this methods to this class, my
advice is.

But anyway, links are external resources therefore can be stored in Resx
file. This would help you integrate your modules/pages with other
applications.

--
HTH

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET

"WFB" <x@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In general, how are other people handling this (in 1.1 and 2.0)? Just
hardcoding the links?

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there
any
way to get to this, or a reccomended altenate approach?

Thanks
Joe



Nov 19 '05 #8
WFB
Sorry - I sent too soon. If possible can you point me to an example of
using the resx file?
"WFB" <x@hotmail.com> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
Thanks. Do you have an example?

"Yunus Emre ALP÷ZEN [MCSD.NET]" <yemre> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
Implement a singleton pattern class and add this methods to this class,
my advice is.

But anyway, links are external resources therefore can be stored in Resx
file. This would help you integrate your modules/pages with other
applications.

--
HTH

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET

"WFB" <x@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In general, how are other people handling this (in 1.1 and 2.0)? Just
hardcoding the links?

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hi,

In asp.net 1.1, it was easy to add this to the properties of a page
(class):

Public Shared ReadOnly Property URL(productId as String) As String
Get
Return AppPath & "/ProductDetails.aspx?productId=" & productId
End Get
End Property

Which I could then access from other pages (which stopped me having to
memorze and hardcode a URL in dozens of pages and user controls).
However, in 2.0 this functionality seems to have dissapeard. Is there
any
way to get to this, or a reccomended altenate approach?

Thanks
Joe



Nov 19 '05 #9
There are too much examples on net. Here are some links for sample codes:

http://www.dotnetjunkies.com/Article...A8134A4F1.dcik

http://www.codeproject.com/csharp/cs...sembly-res.asp
--
HTH

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET

"WFB" <x@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP11.phx.gbl...
Sorry - I sent too soon. If possible can you point me to an example of
using the resx file?
"WFB" <x@hotmail.com> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
Thanks. Do you have an example?

"Yunus Emre ALP÷ZEN [MCSD.NET]" <yemre> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
Implement a singleton pattern class and add this methods to this class,
my advice is.

But anyway, links are external resources therefore can be stored in Resx
file. This would help you integrate your modules/pages with other
applications.

--
HTH

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET

"WFB" <x@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In general, how are other people handling this (in 1.1 and 2.0)? Just
hardcoding the links?

"WFB" <x@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> In asp.net 1.1, it was easy to add this to the properties of a page
> (class):
>
> Public Shared ReadOnly Property URL(productId as String) As String
> Get
> Return AppPath & "/ProductDetails.aspx?productId=" & productId
> End Get
> End Property
>
> Which I could then access from other pages (which stopped me having to
> memorze and hardcode a URL in dozens of pages and user controls).
> However, in 2.0 this functionality seems to have dissapeard. Is there
> any
> way to get to this, or a reccomended altenate approach?
>
> Thanks
> Joe
>




Nov 19 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Henri | last post: by
2 posts views Thread by baldwin | last post: by
5 posts views Thread by Simon | last post: by
6 posts views Thread by wingphil | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.