473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to reference a Page

I have a user control that is reused in 5 .aspx pages and references a
variable called "theSection" which is set in the class for each .aspx page.
If I only had one .aspx page, I would reference the variable "theSection"
like this.

myAspx1.theSection

How do I reference the selected .aspx page--any of which have the user
control within--as a variable so I don't have to you conditionals?

<aspxPageVariable>.theSection

--
_____
DC G
Nov 22 '05 #1
2 1268
Ideally, you don't want your user control, to care about what kind of page
it is on.

You can create a public property or method on your user control, and have
each page using the control be responsible for calling it on the user
control to pass it 'theSection'. The user control could then hang on to it
until needed.

You can also have all your pages using the control inherit from a base class
which has a theSection variable. The user control can then cast its page
object to this baseclass and get theSection.

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:e3***************@TK2MSFTNGP10.phx.gbl...
I have a user control that is reused in 5 .aspx pages and references a
variable called "theSection" which is set in the class for each .aspx page. If I only had one .aspx page, I would reference the variable "theSection"
like this.

myAspx1.theSection

How do I reference the selected .aspx page--any of which have the user
control within--as a variable so I don't have to you conditionals?

<aspxPageVariable>.theSection

--
_____
DC G

Nov 22 '05 #2
Thanks, Marina,

Can you give me an example of this?

_____
DC G

"Marina" <so*****@nospam.com> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
Ideally, you don't want your user control, to care about what kind of page
it is on.

You can create a public property or method on your user control, and have
each page using the control be responsible for calling it on the user
control to pass it 'theSection'. The user control could then hang on to it
until needed.

You can also have all your pages using the control inherit from a base class which has a theSection variable. The user control can then cast its page
object to this baseclass and get theSection.

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:e3***************@TK2MSFTNGP10.phx.gbl...
I have a user control that is reused in 5 .aspx pages and references a
variable called "theSection" which is set in the class for each .aspx

page.
If I only had one .aspx page, I would reference the variable "theSection" like this.

myAspx1.theSection

How do I reference the selected .aspx page--any of which have the user
control within--as a variable so I don't have to you conditionals?

<aspxPageVariable>.theSection

--
_____
DC G


Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alphonse Giambrone | last post by:
How can I reference a page or user control's properties (such as viewstate) and controls from another class? TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
5
by: Alphonse Giambrone | last post by:
How can I reference a page or user control's properties (such as viewstate) and controls from another class? TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
10
by: Alphonse Giambrone | last post by:
How can I reference a page or user control's properties (such as viewstate) and controls from another class? TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.