ASP.NET
  Home arrow ASP.NET arrow ASP.NET Dropdown List Control: Eight Ways ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET Dropdown List Control: Eight Ways to Bind Data
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 99
    2006-01-04

    Table of Contents:
  • ASP.NET Dropdown List Control: Eight Ways to Bind Data
  • Binding to a Simple Array
  • Binding to a Hashtable
  • Binding to a set of objects

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET Dropdown List Control: Eight Ways to Bind Data


    (Page 1 of 4 )

    This article shows you the real power of a dropdown list control available in ASP.NET. It also explains eight methods of binding data to the dropdown list.
    A downloadable file for this article is available here.

    The sample downloadable solution (zip) is entirely developed using Visual Studio.NET 2003 Enterprise Architect on Windows Server 2003 Standard Edition.  But, I am confident that it would work with other versions of Windows (which support .NET 1.1) as well.

    What are the ways to bind data to a drop down list?

    I don’t think there exists any meaningful application which does not have at least one “dropdownlist” control.  Every user definitely knows what a “dropdownlist” is.  The most important issue is that a “dropdownlist” can maintain two sets of values inside. 

    The first set of values display generally the “textual” information (which is visible to the user).  The second set of values is “hidden” from the user.  The user would never know about the “hidden” information.  This flexibility is particularly necessary when you want to display only “student names” to the user and work with “regdno” behind the scenes.  Of course, the user may not identify any student just with the “regdno”!

    Not every scenario needs the two sets of values.  Some may need only one set of values (both “text” and “value” would be the same).  The “dropdownlist” control in ASP.NET supports both of these scenarios. 

    The process of attaching the “dropdownlist” control to a source of data is nothing but “data binding.”  This process of “binding” can occur in several ways including databases, arrays, and so on. In this article, we will mainly look at the following ways to bind (or place) information into a “dropdownlist” control.

    • Binding to a Simple Array
    • Binding to an ArrayList
    • Binding to a hashtable
    • Binding to a data table
    • Binding to a data set
    • Binding to a data view
    • Binding to a set of objects
    • Binding manually

    The above are the most frequently used “data binding” mechanisms when we work with a “dropdownlist” in ASP.NET.  Now, let us go through each of those methodologies.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · We hope you found this article educational and useful. Please feel free to let the...
       · Hello guys! I am ready for any discussion on this topic. Any doubts, do post them. ...
       · hai, i am new to ajax so please help mei would like to know what is the...
       · hi,i am new here.its really great.this article helped me to explor more.plz tell...
       · thanks for taking time to write this up , i found it really useful and...
       · please give this article in c#.
       · Hi...Really its a good work... God Bless and continue this...
       · Nice article. Please also refer to the article about binding dropdownlist in MVC...
       · should i use direct binding of drop down through data table or should i insert(add)...
     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek