473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

User Control Datasource

Hi,

I have a button on a form, that opens a second form where I'm cloning
a usercontrol, something akin to Access' continuous forms. Now, in
this usercontrol I have a couple comboboxes. Now I need to run a
query to get the data I want to set as these comboboxes' datasource.
How can I set the datasource just ONCE, as opposed to each time the
control is cloned? This is creating a huge performance hit. Thanks.

Sep 13 '07 #1
1 2762
On 13 Sep, 20:05, Chris <coz1...@gmail.comwrote:
Hi,

I have a button on a form, that opens a second form where I'm cloning
a usercontrol, something akin to Access' continuous forms. Now, in
this usercontrol I have a couple comboboxes. Now I need to run a
query to get the data I want to set as these comboboxes' datasource.
How can I set the datasource just ONCE, as opposed to each time the
control is cloned? This is creating a huge performance hit. Thanks.
Perhaps pass the existing DataSource to your new form? Note that the
designer doesn't help you do this - but there is absolutely nothing to
stop you from creating something like below... then just update
DataSource [and possibly DataMember] when creating the sub-form.

public SubForm : Form {
// bs created / disposed as normal; combos bound to this
private BindingSource bs;

public object DataSource {
get { return bs.DataSource; }
set { bs.DataSource = value; }
}
public string DataMember {
get { return bs.DataMember; }
set { bs.DataMember = value;}
}
}

Sep 14 '07 #2

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

Similar topics

0
by: Zi | last post by:
I have a user control within a data grid. I am binding the user control to one of the values from the data grid. The data grid implements paging. It is all working ok for the first page but once i...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
0
by: Rick Wez | last post by:
I feel like I'm going to pull out my hair (there's not much left); I've read almost every online post trying to figure this out. So I started over with something VERY simple and it still doesn't...
6
by: WebBuilder451 | last post by:
I have a drop down list of saved searches for a user and i'm trying to use the datasource control to populate the ddl. The select value in the storedproc is the user.Identity.name. How can i use...
7
by: Mukesh | last post by:
Hi all I have to transfer a dataset and a string from a webform to a user control on the page without using viewstate or session or cookies . properties method is not working properly. if...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
3
by: HP | last post by:
hi there Is it possible to bind a datasource to a dropdownlist contained in a user control if datasource is positioned on the parent page of user control? I guess not, since user control...
1
by: Dave A | last post by:
I have a problem that I have boiled down to a very simple example. I have a user control that displays a some data from a business object. On one screen I have a collection of these business...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
1
Eleven
by: Eleven | last post by:
Hi everybody! I've got a User Control "SelectBatchByTerminal", that has two dropdown lists, "TerminalDropDownList" and "BatchDropDownList". using System; using System.Data; using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...

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.