Data Listing Web ControlsData Listing Web ControlsMacDonald Ch. 13-14MacDonald Ch. 13-14
MIS 324Professor Sandvig
OutlineOutline Web Controls OverviewWeb Controls Overview TabularTabular
• RepeaterRepeater• DataListDataList• GridViewGridView
Single RecordSingle Record• FormViewFormView• DetailsViewDetailsView
Web Controls OverviewWeb Controls Overview Classes all located in Classes all located in
system.web.ui.webcontrols system.web.ui.webcontrols namespacenamespace• Documentation
Too many controls to coverToo many controls to cover• New controls added each versionNew controls added each version
Focus on essential controls & Focus on essential controls & conceptsconcepts
Web Controls OverviewWeb Controls Overview Simple ControlsSimple Controls
• Display single itemsDisplay single items• Correspond to HTML tagsCorrespond to HTML tags• textbox, radiobutton, checkbox, button…textbox, radiobutton, checkbox, button…
List ControlsList Controls• Name/Value pairsName/Value pairs• RadioButtonList, CheckBoxList, Dropdown ListRadioButtonList, CheckBoxList, Dropdown List
Web Control OverviewWeb Control Overview Tabular ControlsTabular Controls
• Display > 1 columnDisplay > 1 column• DataList, GridView, RepeaterDataList, GridView, Repeater
Single Record ControlsSingle Record Controls• FormViewFormView
TemplatesTemplates• Use to describe data formatUse to describe data format
Tabular ControlsTabular ControlsDisplay multiple columns of dataDisplay multiple columns of data
• GridViewGridView Display data in table formatDisplay data in table format Most features – editing, paging, sortingMost features – editing, paging, sorting Constraint: one data item per cellConstraint: one data item per cell
• DataListDataList No default format – must use templatesNo default format – must use templates Very flexible formatting Very flexible formatting Editing featuresEditing features
• RepeaterRepeater Read only, most efficient for data displayRead only, most efficient for data display No default format – must use templatesNo default format – must use templates
Tabular ControlsTabular Controls Consist of rows and fieldsConsist of rows and fields Fields may contain other controlsFields may contain other controls
• ButtonsButtons• HyperlinksHyperlinks• TextboxesTextboxes• DropDownListsDropDownLists• Other tabular controlsOther tabular controls
Need to access control propertiesNeed to access control properties• ““FindControl” methodFindControl” method
Handle control eventsHandle control events• Events “bubble up” to parent controlEvents “bubble up” to parent control
Tabular ControlsTabular Controls DataList ControlDataList Control
• Very flexible formatVery flexible format Template requiredTemplate required
• Supports editingSupports editing• Repeat columns propertyRepeat columns property
• Example: DataListing (source)Example: DataListing (source)• Web.config sourceWeb.config source
SummarySummary Data AccessData Access
1.1.ProgrammaticProgrammatic Connection & command objectsConnection & command objects
2.2.DeclarativeDeclarative Drag & drop via VSDrag & drop via VS
Data listing server controlsData listing server controls• List controlsList controls• Tabular ControlsTabular Controls
Next: two-way databinding Next: two-way databinding