D
darrel
I have this structure:
mypage.aspx (class = mypage)
myusercontro.ascx
On the mypage.aspx I can declare a variable:
animal = "monkey"
I can read this from the UC by simply doing this:
mypage.animal
How can I do that if I don't know which parent page the UC is being loaded
into (ie, it's being dynamiacally loaded)? I'm not sure how to find out what
the classname of the parent page is from the UC.
DISCLAIMER: It's my understanding that this isn't usually the preferred
method of passing data between the two and that, rather, I'd be better off
having the parent tell the UC what the variable is, instead of relying on
the UC to read it from the parent. I'm warming up to that concept, but, in
this case, it seems to be more work tha not. For instance I have 10 parent
pages and 10 UCs. If I set the variable in 10 UCs, and have each UC read it,
I'm only needing to maintain/set 10 bits of code. However, if the 10 parent
pages need to tell each individual control, then that's 100 bits of code
that need to be created to maintain things. So, to ask a second question, is
my logic wrong? If so, what are the drawbacks to my line of thinking (having
the UC read the variable from the parent)? (John has got me thinking down
this road...so, thanks John! and if anyone else would like to add their
opinion to the matter, please do!)
-Darrel
mypage.aspx (class = mypage)
myusercontro.ascx
On the mypage.aspx I can declare a variable:
animal = "monkey"
I can read this from the UC by simply doing this:
mypage.animal
How can I do that if I don't know which parent page the UC is being loaded
into (ie, it's being dynamiacally loaded)? I'm not sure how to find out what
the classname of the parent page is from the UC.
DISCLAIMER: It's my understanding that this isn't usually the preferred
method of passing data between the two and that, rather, I'd be better off
having the parent tell the UC what the variable is, instead of relying on
the UC to read it from the parent. I'm warming up to that concept, but, in
this case, it seems to be more work tha not. For instance I have 10 parent
pages and 10 UCs. If I set the variable in 10 UCs, and have each UC read it,
I'm only needing to maintain/set 10 bits of code. However, if the 10 parent
pages need to tell each individual control, then that's 100 bits of code
that need to be created to maintain things. So, to ask a second question, is
my logic wrong? If so, what are the drawbacks to my line of thinking (having
the UC read the variable from the parent)? (John has got me thinking down
this road...so, thanks John! and if anyone else would like to add their
opinion to the matter, please do!)
-Darrel