Home > 2011 Winter BTI420 > Lecture notes for Friday January 14

Lecture notes for Friday January 14

January 14, 2011 Leave a comment Go to comments

We will begin coding ASP.NET Web Forms today. You will learn about the basic Web Server controls, and get started learning some list-oriented Web Server controls.

.

Prepare for today’s class

Show up on time. Be alert and mentally agile. Be prepared to learn.

Textbook readings:

Beginning ASP.NET 4 in C# and VB
Chapters 1, 2, 4, 5
ASP.NET 4 Unleashed
Chapters 1, 2

.

Coming up in BTI420

Fri Jan 14 – continue introductory topics lecture

Mon Jan 17 – errors, error-handling, and debugging

.

Topic coverage in today’s lecture

We will follow the content covered in “Beginning” chapter 4, and “Unleashed” chapter 2 today.

.

Getting started with “Web Server controls”

New ASP.NET Web Forms developers will be interested in ASP.NET Web Server controls. The MSDN documentation says this about web server controls:

ASP.NET Web Server controls are objects on ASP.NET Web pages that run when the page is requested and that render markup to a browser.

Many Web server controls resemble familiar HTML elements, such as buttons and text boxes. Other controls encompass complex behavior, such as a calendar controls, and controls that manage data connections.

Your first task will be to become familiar with “controls”. We will start with the basic controls:

  • Hyperlink
  • Label
  • Textbox
  • Button

After we understand these, we will move on to list controls:

  • Dropdown list
  • List box
  • Radio button list
  • Checkbox list
  • Bulleted list

When working with list controls, we need to configure the list with data. We have several ways to configure data, including:

  • Editing the markup, and adding new ListItem objects
  • Using the list item editor, a GUI tool that’s accessed from Design View or the Properties panel
  • Creating a data structure for the list items; we could use an Array, or (better) a generic List

We will learn how to do this today.

.

List web server controls introduction

As noted above, there are five basic and simple “list” oriented web server controls that we will use:

  • Dropdown list
  • List box
  • Radio button list
  • Checkbox list
  • Bulleted 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.) The bulleted list control is also typically a single-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). We can also “bind” the Items collection to an array or a generic list.

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.).

.


Advertisements
Categories: 2011 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: