ASP.NET ComboBox - Populating with Data - DataSet


The ComboBox can be populated from various types of data sources:
  • DataSourceControls - SqlDataSource, ObjectDataSource, LinqDataSource etc.;
  • LINQ - LINQ queries at runtime;
  • Collections (generic & non-generic) - IList, IEnumerable, etc.;
  • DataSet / DataTable;
  • Declarative

The ComboBox presented in this sample is populated from a DataSet. This is done by passing the DataSet to the DataSource property of the ComboBox and calling its DataBind method.

Also, the DataValueField and DataTextField properties need to be used to specify the name of the dataset's columns that will be used to populate the Value and Text properties of the generated ComboBoxItems.

"Thanks much. The trees seem to be working exactly as we want and we do appreciate the timely resolution. As our project moves further along the design process, we find ourselves utilizing Obout controls more and more and it's comforting to know that your support system is so responsive."

Kevin Holder
Tennessee Department of Human Services

obout.com 
obout.com Home 
News 
ComboBox Home   
ComboBox Home 
Examples - 53
Appearance - 1 
Live Styles 
Autocomplete & Filtering - 2 
Autocomplete  
Filtering  
Load on Demand - 4 
Load Items on Demand 
Load Items on Demand with Paging  
Virtual Scrolling  
Initial Text New 
Multi-Columns - 4 
Grid-like Multi-Columns  
Multiple Rows and Columns  
Load multi Columns on Demand  
State Selector  
Items with Icons - 3 
Items with Icons  
Grid-like Multi-Columns with Icons  
Multiple Rows and Columns with Icons  
Templates - 3 
Item Templates  
Header Templates  
Populating with Data - 5 
Declarative  
SqlDataSource  
ObjectDataSource  
Generic Collections  
DataSet  
Item Selection - 6 
Single Item Selection  
Multi Item Selection  
Get Selected Item  
Get Selected Items  
Set Selected Item New 
Set Selected Items New 
Mode - 2 
ComboBox  
TextBox  
Master/Detail - 3 
Master/Detail  
Unlimited Detail Levels  
Cascading ComboBoxes  
Integration - 5 
Items with ASP.NET CheckBoxes  
Items with Obout CheckBoxes  
RadioButtons inside ComboBox  
TreeView inside ComboBox  
ComboBox inside Grid  
Settings - 8 
AllowCustomText  
AllowEdit  
AutoPostback  
AutoValidate  
Height  
MenuWidth  
OpenOnFocus  
Width  
Server-Side API - 2 
Server-Side Events  
Enable / Disable  
Client-Side API - 5 
Client-Side Events  
Add / Remove Items  
Enable / Disable  
Get Selected Item  
Knowledge Base - 1 
Knowledge Base 
Documentation - 13 
Server-Side 
ComboBox 
ComboBoxClientSideEvents 
ComboBoxCssSettings 
ComboBoxFilterType 
ComboBoxFooterTemlateContainer 
ComboBoxHeaderTemlateContainer 
ComboBoxItem 
ComboBoxItemEventArgs 
ComboBoxItemTemlateContainer 
ComboBoxLoadingItemsEventArgs 
ComboBoxMode 
Client-Side 
Client-Side API 
ChangeLog 
Tutorials - 1 
Using the correct path