472,954 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

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
9 1055
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
1
by: Henri | last post by:
Hi, I'm using a custom class in my ASP.NET which has a Shared property. I don't want this Shared property to be shared between users because of thread concurrent accesses problems. I just want it...
8
by: Mike Caputo | last post by:
In VB.NET, need to be able to access certain properties on my main form from other forms. These are properties that may be changed by the user, so I have to be able to get to them throughout the...
9
by: Bob Day | last post by:
VS 2003, vb.net , sql msde... I have an application with multiple threads running. Its a telephony application where each thread represents a telephone line. For code that would be the same...
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
2
by: baldwin | last post by:
Hello, We are going to have a web application that will be load balanced. Uploading documents into the same server is not an option. So we need to create a shared folder in a different machine...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
2
by: mgoold2002 | last post by:
Hello. I've just begun programming in VB .NET, and I'm trying to turn all my modules into classes. In order to retrieve/exchange values from one class to another, I initiated New instances of the...
6
by: wingphil | last post by:
Hi there, I have a shared method in a base class, and I need to know which subclass it has been called from. So for example Public Mustinherit Class BaseClass Public Shared Sub SharedMethod...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.