473,408 Members | 1,968 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,408 software developers and data experts.

Object loaded in Page & UserControl... not sure if i"m doing this right...

AC
I have a page class that inherits the System.Web.UI.Page class. Essentially what it does is load a user profile from a session (if it isn't loaded, it loads it into the session) and exposes it via a public property. This works just fine.

I have user controls that require the profile as well and I was coding it to work in the same way (created a class that inherits the System.Web.UI.UserControl class. It does the exact same thing as the page class I created.

My question is I'm wondering if I'm doing more owrk than is necessary. Can the UserControl see the page object? If it can, what's the execution order (would the control execute before the page so the user control wouldn't have access to the profile)?

Thanks in advance.

Nov 18 '05 #1
1 1208
A UserControl object exposes a Page attribute, which you can use to get a
reference to the hosting page. If you initialize your variable in your
OnInit event handler of your page, and then read it in your OnLoad event
handler of your control, you should be fine.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"AC" <sp**@aNOSPAMMEconnell.com> wrote in message
news:eL****************@TK2MSFTNGP11.phx.gbl...
I have a page class that inherits the System.Web.UI.Page class. Essentially
what it does is load a user profile from a session (if it isn't loaded, it
loads it into the session) and exposes it via a public property. This works
just fine.

I have user controls that require the profile as well and I was coding it to
work in the same way (created a class that inherits the
System.Web.UI.UserControl class. It does the exact same thing as the page
class I created.

My question is I'm wondering if I'm doing more owrk than is necessary. Can
the UserControl see the page object? If it can, what's the execution order
(would the control execute before the page so the user control wouldn't have
access to the profile)?

Thanks in advance.
Nov 18 '05 #2

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

Similar topics

0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
2
by: tlk | last post by:
Hi, everyone. I'm having a problem that I hope some more experienced developers can help me figure-out. We have a project called Records that has been around for a year or so. We're currently...
3
by: j-in-uk | last post by:
I have 3 pages Site.master, Album.aspx and ContinentsMenu.ascx. Continents is a usercontrol placed in Albums. In Album.aspx.cs I need to access a property from the Continents usercontrol and is...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.