473,407 Members | 2,629 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,407 software developers and data experts.

Databinding Dropdownlist to Main Dataset

I understand how to bind the Dropdownlist control to a table so that it
shows the list of values, but how do I bind it to my main data entry
dataset?

Thanks for the help!
Jason

Nov 19 '05 #1
2 1155
When you databind a dataset to a dropdownlist or any other bindable control
for that matter, it gets bound to the FIRST table in the dataset.

In order to bind it to any other tables in the dataset you will need to
reference them specifically and bind the actual table to it.

The dropdownlist datasource property will take a dataset as its source just
the same as the datatable.

--
-Demetri
"jdsharp" wrote:
I understand how to bind the Dropdownlist control to a table so that it
shows the list of values, but how do I bind it to my main data entry
dataset?

Thanks for the help!
Jason

Nov 19 '05 #2
dropdownlist1.DataSource = ds;
dropdownlist1.DataMember = ds.Tables[0].TableName;
dropdownlist1.DataTextField = "NAME";
dropdownlist1.DataValueField = "ID";
dropdownlist1.DataBind();

Cheers,

Dhanushka Nuwan
sh******@yahoo.com
"jdsharp" <jd*****@bigfoot.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I understand how to bind the Dropdownlist control to a table so that it
shows the list of values, but how do I bind it to my main data entry
dataset?

Thanks for the help!
Jason

Nov 19 '05 #3

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: Lloyd Sheen | last post by:
I have several apps that use a roll your own approach, but I am embarking on a project which will not allow that with the time constraints. I have gened up a little app to try the databinding...
3
by: John Blair | last post by:
Hi, I want to select an id column and a name column from the database and have the results databound to a SINGLE dropdown control with the value property matched to the database id column and...
1
by: Joe Gass | last post by:
I'd like to bind some xml to a dropdownlist <engines> <engine name="test1" id="1" /> <engine name="test2" id="2" /> </engines> If I do: ddlEngines.DataSource =...
7
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about...
2
by: Nosaj | last post by:
Houston, we've got a problem... In a ascx file, I bind a datasource with a dropdownlist. The following code runs perfectly in a aspx file but not in a ascx file. And I just can't understand it....
0
by: Simon Gregory | last post by:
I am currently attempting to figure out how the new databinding stucture works in ASP.NET 2.0 after working with v1.0 & v1.1 for several years. It seems that if you wish to do set up databinding...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
1
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.