(winform) dynamically adding multiple instances of a user control

G

Guest

I have a user control uc (with a dropdownlist uc_dd) that I dynamically add
to a pane on a button_click. this pane is hosted on the winform. now when I
add two instances of the user control (uc_dd1, uc_dd2), and change the
selected item in the dropdown uc_dd1, the selected item in uc_dd2 also
changes. any ideas?

thank you!
 
M

Marina

Are they both bound to the same datasource? In this case, they each need
their own instance of a bindingcontext.
 
G

Guest

the dropdown in the user control is databound to a dataview.
wouldn't creating different instances of the user control create different
bindingcontext instances? how would you explicitly create a different
bindingcontext?
 
C

Cor Ligthert

Ram,

A little bit else told than Marina.

You can create different datasources by creating more (new) dataviews (and
with that bindingcontext).

The message is the same.

I hope this helps,

Cor
 

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

Top