Home > 2010 Winter BTI420 > List web server controls introduction

List web server controls introduction

January 18, 2010 Leave a comment Go to comments

The "list" web server controls – DropDownList, ListBox, CheckBoxList, and RadioButtonList – are controls that you often use on ASP.NET Web Forms. They also offer the new ASP.NET learner a rich set of lessons about objects.


List web server controls introduction

There are four simple "list" oriented web server controls that we will use:

  • Dropdown List
  • Radio button list
  • List box
  • Check box list

All work in pretty much the same manner, they just render differently.

The first three, by default, are single-selection controls, while the CheckBoxList control is a multi-selection control. (The ListBox control can be configured to be a multi-selection control.)

All can be configured to automatically post back to the server if a selection changes.

One of the most important concepts to understand about a list control is that it is a class. When you drag a list control from the toolbox to the designer, you are creating an instance of the class. The instance supports static setting of the list’s items at design time, but it also supports programmatic setting at run time, as well as data binding to a source of data for the list.

Another important concept to "get" is that a list control has an "Items" collection. (A collection is a set of objects which can be referenced by position or identity/name. You can add or remove from a collection. You can also modify a collection’s elements.) The Items collection type is ListItem. Therefore, a list control has a collection of ListItem’s. A ListItem class has a Text property, a Value property, and a Selected property (and a couple of others).

I hope you just got the message that we’ve gone way beyond simple types here (i.e. single or array instances of int, bool, char, etc.).


Categories: 2010 Winter BTI420
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: