473,769 Members | 5,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(winform) dynamically adding multiple instances of a user control

ram
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!

Jul 21 '05 #1
3 3044
Are they both bound to the same datasource? In this case, they each need
their own instance of a bindingcontext.

"ram" <ra*@discussion s.microsoft.com > wrote in message
news:18******** *************** ***********@mic rosoft.com...
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!

Jul 21 '05 #2
ram
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?

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

"ram" <ra*@discussion s.microsoft.com > wrote in message
news:18******** *************** ***********@mic rosoft.com...
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!


Jul 21 '05 #3
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
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4198
by: Jack David | last post by:
I have a number of web user controls that I want to be able to load into a page. I want to be able to define what controls to include in the page, and what order they should appear in. I am using C# Example: Web Control 1 = Greeting Web Control 2 = Select Credit Card Type If Session ScriptID = A then I would want to display
1
5659
by: David J. Berman | last post by:
Thanks for any help...! My error is: Object reference not set to an instance of an object. > public int DisplayOrder { > get { >>>>>> return (int) ViewState; > }
3
685
by: ram | last post by:
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!
0
1196
by: Bob Harrison | last post by:
After installing the Media SDK and looking at the vb sample I was able to create a control that includes the media player plus other form controls. I want to add multiple instances of this control to a windows form. I was able to get this to work...almost. The problem I have is that after adding mutiple instances of the control by pressing a button, the videos try to play at the same time on the first instance of the control. The stop, mute...
6
11081
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
7
2133
by: =?Utf-8?B?Li46OiBLZXZpbiA6Oi4u?= | last post by:
I have a problem with accessing controls that I have loaded dynamically and added to a web page. The scenario: I have a webpage that displays multiple instances of a user control on the page. The number of controls that are displayed can be adjusted by the user so the controls are added to the page dynamically using the following code in the Page_Init event handler: For i as Integer = 1 to NumberOfControls
1
7596
by: jelle.huygen | last post by:
Hello, I have a problem in ASP.NET 2.0 with the viewstate of my dynamically added user control. I have reproduced the problem with a very simple user control and a very simple page. On my usercontrol is a button and a label. Everytime the button is clicked a counter which is stored in the viewstate is increased and displayed in the label.
7
1920
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have a WinForm application that, depending on user actions, may spin for a while doing extensive calculations, showing a progress bar in the meantime. I would like to be able to launch a second complete copy of the main form so the user may start a second lengthy calculation if desired. I have a menu item to "Launch New Workspace" but I am having difficulty implementing this. I detail my experiments below; any suggestions on the proper...
4
4492
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is selected, the row is added using JavaScript. The script uses cloneNode to clone a hidden template row and all of its children and then adds the new row to the table, updates all of the child control Ids and sets visibility etc. The hidden...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.