Introduction to ASP.NET - Western Washington University

Download Report

Transcript Introduction to ASP.NET - Western Washington University

Data Listing Web Controls
MacDonald Ch. 13-14
MIS 324
Professor Sandvig
Outline


Web Controls Overview
Tabular
• Repeater
• DataList
• GridView

Single Record
• FormView
• DetailsView
Web Controls Overview

Classes all located in
system.web.ui.webcontrols
namespace
• Documentation

Too many controls to cover
• New controls added each version

Focus on essential controls &
concepts
Web Controls Overview

Simple Controls
• Display single items
• Correspond to HTML tags
• textbox, radiobutton, checkbox, button…

List Controls
• Name/Value pairs
• RadioButtonList, CheckBoxList, Dropdown List
Web Control Overview

Tabular Controls
• Display > 1 column
• DataList, GridView, Repeater

Single Record Controls
• FormView

Templates
• Use to describe data format
Tabular Controls
Display multiple columns of data
• GridView



Display data in table format
Most features – editing, paging, sorting
Constraint: one data item per cell
• DataList



No default format – must use templates
Very flexible formatting
Editing features
• Repeater


Read only, most efficient for data display
No default format – must use templates
Tabular Controls


Consist of rows and fields
Fields may contain other controls
•
•
•
•
•

Buttons
Hyperlinks
Textboxes
DropDownLists
Other tabular controls
Need to access control properties
• “FindControl” method

Handle control events
• Events “bubble up” to parent control
Tabular Controls

DataList Control
• Very flexible format

Template required
• Supports editing
• Repeat columns property
• Example: DataListing (source)
• Web.config source
Summary

Data Access
1.Programmatic

Connection & command objects
2.Declarative


Drag & drop via VS
Data listing server controls
• List controls
• Tabular Controls

Next: two-way databinding