I've tried the initial task using the syntax both you and Steve recommended,
however, either way I get compile-time errors, the message of which is
something like:
'System.Web.UI.Page' does not contain a definition for 'myPublicVariable'
It makes sense that such compile-time errors would occur, as the user
control - at compile time - does not know which aspx page will be hosting
it, and the compiler therefore cannot know where to look to see if the
public property exists. Am I confused? Is it possible to do this without
getting the compile-time error and I'm just missing something.
Thanks.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:ug**************@TK2MSFTNGP11.phx.gbl...
put in a break point and test it to see.
You may need to move it up to the intialize event though
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Gene" <Mr******@jw.com> wrote in message
news:OT**************@tk2msftngp13.phx.gbl... Thanks Curt and Steve: Now a related question: I set the public variable
from the aspx page_load event procedure, and want to I read that public
variable from the page_load event procedure of the user control. In
order for this to work as expected, I need for the page_load event of the aspx to fire *before* the page_load of the user control. Is that a safe
assumption?
Thanks again.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:e7**************@TK2MSFTNGP09.phx.gbl... On the page make sure it's public
From the control, something like
string myVar = this.ParentPage.variableName.ToString();
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Gene" <Mr******@jw.com> wrote in message
news:O5**************@TK2MSFTNGP11.phx.gbl...
> I have a number of aspx pages on which a single user control
appears. All of
> the aspx pages and the user control make user of code-behind
modules. I need
> for logic in the user control's code-behind to read the current
value of a > variable in the hosting aspx page's code-behind. How is this
accomplished? >
> Thanks.
>
>