Controlling a dropdown list from a separate user control

I

Iams

I have one form, with 2 user controls. How can I get the procedures on uc2
to modify a drop down list on uc1?

I tried various versious of this in uc2:
uc1.ddl.SelectedIndex =
uc1.ddl.Items.IndexOf(uc1.ddl.Items.FindByValue(Session("ContactID")))

The end result being a user selects something in uc2, I want the drop down
list in UC1 to be updated as a result.
 
W

Wilco Bauwer

If a usercontrol is not independent (which it isn't in this case), I
would probably go for raising an event. A container which knows about
the relevant usercontrols could then be a "mediator", e.g: take care of
handling an event of 1 control and doing stuff with another control.

I can see several cases where you'd like to be able to do stuff in 1
usercontrol based on input from another usercontrol. For that reason,
we (Variomatic) created a solution with a connection mechanism. This
allows you to connect different "webparts" (which in the end are equal
to usercontrols). Usercontrols can handle events of consumer connection
points, which are raised when a provider connection point provides
"data". You can read more about this on
http://wilcoding.xs4all.nl/wilco/articles.aspx.

Both Sharepoint and ASP.NET 2.0 have a connection mechanism aswell,
although I personally dislike Sharepoint's implementation (too much
plumbing needed).
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top