473,770 Members | 7,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to bind data from database access to drop down list control?

Hi all,
I am new to ASP.NET, i have met some problems in binding data from a
table of database to a dropdown list control. Anyone knows how to do it?if
possible can rougly write the codes or any tutorials regarding this...Thanx
in advance...

From,
Joey

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
1 6072
Here's some code:

private void BindDropdownLis t()
{
ddlSector.DataS ource = Sectors.GetAll( );
ddlSector.DataT extField = "Name";
ddlSector.DataV alueField = "ID";
ddlSector.DataB ind();
}

Call the method BindDropdownLis t() in PageLoad.
Sectors.GetAll( ) returns a table. The table have two coloums: Name and ID.
"Joey Liang via DotNetMonster.c om" <fo***@nospam.D otNetMonster.co m> skrev i
melding news:70******** *************** *******@DotNetM onster.com...
Hi all,
I am new to ASP.NET, i have met some problems in binding data from a
table of database to a dropdown list control. Anyone knows how to do it?if
possible can rougly write the codes or any tutorials regarding
this...Thanx
in advance...

From,
Joey

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2

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

Similar topics

3
4447
by: Satish | last post by:
Hi, I am facing problem with, sending data frm mdi child to mdi parent. I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click search button, i am displaying Details form with all the details. Their i have Delete button. When we click on delete button, we have to delete the record from database
1
1772
by: Satish | last post by:
Hi, I am facing problem with, sending data frm mdi child to mdi parent. I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click search button, i am displaying Details form with all the details. Their i have Delete button. When we click on delete button, we have to delete the record from database and at the same time, i have to delete record from the drop down.
3
2875
by: John Crowley | last post by:
I've run into a problem where drop down lists are refusing to data bind with the following error on the DataBind() call Specified argument was out of the range of valid values. Parameter name: value Stack trace is showing the error in OnDataBinding event, which I don't hook in the cases where I'm getting this error ArgumentOutOfRangeException: Specified argument was out of the range of valid values Parameter name: value...
2
2214
by: Rob G | last post by:
Hi, I've made a User Control with a drop-down list box (OK, copied it out of a book). It binds to a SQL statement which links to my database. All the code is in the ascx.vb file. Now I want to make a User Control drop-down list box that only has two values, "Yes" and "No". That way I can use it in multiple places (that is the right idea?). I just can't figure out how to do this using VS2003 and VB. I am originally an Access user, so I...
3
2479
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list becomes shorter & shorter for the user to choose a value from. For example, suppose the user wants to select the name "Michael" from the dop down list . So when he tabs over & reaches this drop down list, he types "Mi" , then all the names...
13
2090
by: MikeS | last post by:
I am relatively new to VB.Net so bear with me. I can add an OleDBDataAdapter using the Jet 4.0 with no problem (although I'm having problems getting Date and Time formats to carry over to the database). However, I can't seem to get the SQLDataAdapter to work. When I click on the provider tab it defaults to “Microsoft OLE DB Provider for SQL Server”. On the connection tab I have to enter the name of an SQL server name (the drop down...
6
3152
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key identifier, I would like a dropdown combo box (lookup from the "order_type" table) to change the type of the order. I also need an update command button, a delete row button and also an insert new row button. I'm sure this is a very common design...
0
2358
by: yosri2005 | last post by:
Hello, I'm sure many of you have seen the error message in the subject. I found quiet a few posts on the web regarding this issue, but the ones I saw mainly tackle this issue when you have a drop-down list depending on another drop-down list within a form view. This is not what I'm trying to do, so I didn't know how to apply the solutions I found to my problem. I have a formview which inserts items into a database table via an
8
3273
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've searched high and low through help databases and on the internet. The directions say to : Open the table in Design view Click the Data Type column of the field you want to change, click the
0
10230
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
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
10004
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
9870
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
8886
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
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
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.