ASP.NET Code
  Home arrow ASP.NET Code arrow How to Use the ListBox Control in ASP.NET ...
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 CODE

How to Use the ListBox Control in ASP.NET 2.0
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 105
    2007-02-27

    Table of Contents:
  • How to Use the ListBox Control in ASP.NET 2.0
  • Usage of the ListBox Control in web pages
  • ListBox Examples
  • Dynamic binding to data at run time
  • Databound ListBox Example
  • Steps in converting a Unbound ListBox to a Bound ListBox

  • 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


    How to Use the ListBox Control in ASP.NET 2.0


    (Page 1 of 6 )

    Any developer who is using the Listbox control in his applications needs to be aware of how data binding has changed from VS 2003 to ADO.NET 2.0. This article will explain the changes. It appears to be an improvement over the previous techniques used.

    Introduction

    While the concept of data binding has not changed, the mechanics and objects involved in data binding have changed from VS2003 (.NET Framework 1.1x) to ADO.NET 2.0. This can be easily seen by comparing the Toolbox items in VS2003 and VS2005 as shown in the next two pictures. The connection, command, transactions, parameters have been replaced by the DataSource Controls. The data binding in ASP.NET 2.0 relies on the data binding expressions and the data source controls. This tutorial is about the ListBox control and how it is bound to data. It should interest those who might be using ListBox Control in their applications. You will see for yourselves how much better off you will be using the Data Source Controls in ADO.NET 2.0.

    VS 2003

    VS 2005

    ListBox Control

    The ListBox control displays items in a list appearing sequentially and vertically in a scrollable window. It may display single or multiple items. It usually displays items by pulling the information from memory and formatting them according to the way they are requested. The ListBox control as seen in the Object Browser of VS 2005 has its inheritance as shown in the next paragraph.

    Public Class ListBox Inherits System.Web.UI.WebControls.ListControl Member of: System.Web.UI.WebControls Summary: Represents a list box control that allows single or multiple item selection.

    This inheritance is common to the other type of list controls as well, such as DropDownList, CheckBoxList, RadioButtonList and the BulletItemList which is new in VS 2005.

    Because of this inheritance one can access a large number of properties, methods and events of the list controls in applications shown in the Object Browser.

    The ListBox control has additional properties for setting its BorderColor, BorderStyle, and BorderWidth. Also it has some properties not available in other types of list controls, namely Rows and SelectionMode properties shown in the object browser.

    More ASP.NET Code Articles
    More By Jayaram Krishnaswamy


       · Declarative binding makes it very easy to work with databases even for those who are...
       · I am using the FormView control to create a form with a number of different type of...
       · Does the stored procedure work in the management studio correctly without...
     

    ASP.NET CODE ARTICLES

    - How to Use the ListBox Control in ASP.NET 2.0
    - How to Load XML Documents in ASP.NET 2.0
    - DataGrid Code
    - ASP.NET Guestbook
    - User Controls and Client Side Scripting
    - ASP.NET Programming with Microsoft's AS...
    - ASP.NET Basics (part 3): Hard Choices
    - ASP.NET Basics (part 2): Not My Type
    - ASP.NET Basics (part 1): Nothing But .Net
    - Directory Tree Browser
    - How to get the confirmation of Yes/No from a...
    - Complete example using custom errors and wri...
    - Paging Certain # records per page .NET style
    - General Methods of formatting and Subtractin...
    - .NET LinkButton web control





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