Getting a property of a control inside a usercontrol, from another usercontrol

F

Fabiano

Please,

i have a ASPX that contains two usercontrols, TOP.ASCX and CENTER.ASCX. The
first one has a dropdown list inside of it and the second one has a
Datalist.
When user changes the SelectedItem from the dropdown i need to change the
databind from my Datalist.

My doubt are. How can i read from inside the CENTER.ASCX, the dropdown
values from TOP.ASCX? I think that OOP don't let me do that, 'cause of
encapsulation. It's right?

At my fashion i'm using a session at the ASPX, something like this:
Session["CodigoProdutora"] =
(Page.FindControl("Topo1").FindControl("cboProdutora") as
DropDownList).SelectedValue;

But i guess that there's another pretty way that i do the samething without
use Sessions. There's?

Thks if you folks could send me some help.

Fabiano
 
K

Kha Tran

- create a event EVENT (when dropdownlist changes value) in usercontrol
TOP.ascx.
- In the page containning instance ITOP (TOP.ascx) and ICENTER
(CENTER.ascx),
get a event Event of ITOP and write codes to control ICENTER.
 
G

Guest

just a thought,
you can consider storing the selected value in a hidden field using
javascript and later use the value in the hidden field for any manipulation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top