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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 / 80
    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#.
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT