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

Controls calling other controls problem - ASP.NET 2.0

Hi

I have a web page (content.aspx) that inherits from a master page
(MasterPage.master).

The master page has a control (which has to be on every web page, hence on
the master page) (MasterControl.ascx). When placed on the master page this
appears as <uc1:MasterControl ID="MasterControl1" runat="server" />.

The MasterControl's Page_Init() event will contain some code to examine the
Request object's properties (cookies) and calculate some value that it will
expose as a property. This property is called "ImportantProperty()".

Content.aspx has a specific control on it (ContentControl.ascx). When
placed on the web page this appears as
<uc1:ContentControl ID="ContentControl1" runat="server" />.

The problem...

The ContentControl.ascx's Page_Load() event must call the
"ImportantProperty()" in the MasterControl. The resulting value dictates
which view (another user control) to dynamically load at run time
(View1.ascx, View2.ascx or View3.ascx).

MSDN gives an example of how to call a property on the MasterControl from
the Content.aspx page but NOT from a control on the Content.aspx page.
Microsoft's example can be found on:
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx I've tried to amend
their example without success....could someone put me out of my misery
please?

Many thanks

Griff
Sep 21 '06 #1
2 1371
Have the page call to each control. Ultimately, the architecture is such
that both the user control and the web control are controls on the page. The
control of painting is passed to the master page, which makes it appear
different, but it is, in essence a user control.

Your other option is to iterate through the page controls until you find the
master page, use reflection and set the property. I have not personally
tried this, but this is the only way I know of getting the property.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Griff" <ho*****@the.moonwrote in message
news:Or**************@TK2MSFTNGP02.phx.gbl...
Hi

I have a web page (content.aspx) that inherits from a master page
(MasterPage.master).

The master page has a control (which has to be on every web page, hence on
the master page) (MasterControl.ascx). When placed on the master page
this appears as <uc1:MasterControl ID="MasterControl1" runat="server" />.

The MasterControl's Page_Init() event will contain some code to examine
the Request object's properties (cookies) and calculate some value that it
will expose as a property. This property is called "ImportantProperty()".

Content.aspx has a specific control on it (ContentControl.ascx). When
placed on the web page this appears as
<uc1:ContentControl ID="ContentControl1" runat="server" />.

The problem...

The ContentControl.ascx's Page_Load() event must call the
"ImportantProperty()" in the MasterControl. The resulting value dictates
which view (another user control) to dynamically load at run time
(View1.ascx, View2.ascx or View3.ascx).

MSDN gives an example of how to call a property on the MasterControl from
the Content.aspx page but NOT from a control on the Content.aspx page.
Microsoft's example can be found on:
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx I've tried to
amend their example without success....could someone put me out of my
misery please?

Many thanks

Griff

Sep 21 '06 #2
Hi

Do you have any code example? I'm just not sure how the Content Page's User
Control can access properties on the Master Page's User Control....

Thanks

Griff
Sep 21 '06 #3

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

Similar topics

11
by: ThunderMusic | last post by:
Hi, I'm currently stuck with a big problem. I must develop a Windows service and an application to configure it and display what is happening. The problem is not really on the service side, but on...
2
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling...
4
by: Dan Baker | last post by:
I have a form with several controls. I would like to paint *over* several controls (mainly GroupBoxes and Labels). But, Everywhere I try to perform painting, I end up "behind" the controls. I need...
3
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it...
3
by: Ken Varn | last post by:
I am just starting the process of creating ASP.NET server controls. I have created controls for .NET applications, but have just started with ASP.NET. I am a little confused about some areas that...
1
by: pbb | last post by:
I'm creating a set of dynamic controls on a webpage by calling my BuildControls sub in the Page_Init sub. I recreate the controls by calling the BuildControls sub in the LoadViewState override...
2
by: madani | last post by:
Hi, I made custom web control. this control have an Event like "TestEvent", How can I find out if properties of other controls of parent Page is changed inside this event when I fire that event...
4
by: rn5a | last post by:
Assume that a ASPX page uses a user control named Address.ascx which has 2 TextBoxes. This ASCX page creates 2 properties named 'Address' & 'City' using the Get & Set statements: <script...
15
by: Ofer Zelig | last post by:
I'll describe the simplest situation of the problem. I have a simple Web User Control which only contains a: <div id="bla" runat="server" /. I dynamically add it to a page, by performing: ...
4
by: TS | last post by:
Steven, i lost this message conversation from outlook express and made a post online (see last one on this page). Please answer it as it hasn't been yet. thanks The clientID of our controls...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.