Using ASP.NET List Controls

71066 Users read it.
by Kevin Marshall
This tutorial will explain how to correctly use the ASP.NET List Controls. These comprise of three types of control, DropDownList, ListBox and HTMLSelect. During the course of this tutorial you will learn how to bind dynamic data such as Database contents and how these controls can interact with events and other controls on your page. A common problem associated with using these controls in Dreamweaver where the selected item often ends up being the first item in the list after a postback is solved. How to manually insert, delete and pre-select items in a list controls is also shown.
User Rating (131 votes)
Support



Details...
User Level:Any
Product:Dreamweaver MX
Server Language:C#, VB.NET
Technologies:HTML, .NET
Number Of Pages:13
  • An introduction to the available list controls
  • An introduction to the ListItem class
  • The DropDownList Control
  • The ListBox Control
  • The HTMLSelect Control
  • Defining the items of a list control
  • Programmatically Adding items to a list control
  • Programmatically Inserting items into a list control
  • Programmatically Selecting items in a list control
  • Programmatically Removing items from a list control
  • Binding Database content to a list control
  • Binding collections (Arrays) to a list control
  • A Common problem and solution
  • Summary

    During the course of this tutorial you learned about the List Controls available and the differences between them, you then learned how to fill these List Controls using various methods such as hard coding and dynamically from a DataSource. You also learned how to Add, Insert, Select and Remove ListItems programmatically. Finally you learned how to cure the common problem of the SelectedItem being lost on PostBack caused by Dreamweavers implementation of List Controls.

    Follow us on twitter Subscribe to our RSS feed
    Activate your free membership today | Login | Currency