rom said:
Thanks for the quick response. I'm asking, for example,
about reading the selectedvalue of a dropdownlist that
exists in the aspx page from it's ascx page....
Again, you're talking objects now.
How would you handle this if there were some integer inside of object A
wihch you wanted to be able to access from object B? With a property!
However, your user controls are inside of your page. The usual way to handle
this sort of thing is for the container to set the properties of the
contained objects, and not the other way around. For instance, you could add
a ListSelectedIndex property to your user control, and your page could set
it in Page_Load or in the DataBinding event of the user control. If the user
control wanted to be able to change the SelectedIndex, it should expose a
public event. The page could listen for that event and set the SelectedIndex
accordingly. The event arguments would have to pass the new index.
Note how this isolates the page and the control from each other. The page
doesn't have to know _why_ the user control wants the SelectedIndex changed,
and the user control doesn't know anything at all about the DropDownList.
You could even change it to use a different control, and the user control
wouldn't care at all.
John Saunders