training sessions.net controls. standard controls label textbox checkbox button, image button,...

30
TRAINING SESSIONS .NET Controls

Upload: franklin-bates

Post on 13-Dec-2015

222 views

Category:

Documents


3 download

TRANSCRIPT

TRAINING SESSIONSTRAINING SESSIONS

.NET Controls

Standard Controls Label Textbox Checkbox Button, Image Button, Image control Radio Button Literal Hyperlink Panel

Validation Controls Required Field Validator Range Validator Compare Validator Regular Expression Validator Custom Validator Validation Summary

Datasource Controls SQL Datasource XML Datasource Object Datasource Access Datasource Sitemap Datasource

Data Bound Controls Grid View List View Details View Form View Repeater Data List Drop Down List

Displays tabular data Display, edit, and delete data from many different

kinds of data sources, including databases, XML files, and business objects that expose data.

Automatically bind to and display data from a data source control.

Select, sort, page through, edit, and delete data from a data source control.

Specifying custom columns and styles. Adding your own code to the functionality of

the control by handling events.

Grid View

DatasourceID Bind to datasource control

DataSource Bind to various objects

Datasets Data tables Collections

Grid View - Data binding

Grid View - Data binding using DatasourceID

Grid View - Data binding using DataSource

Grid View - Data binding using DataSource

Enable AllowSorting property to true Setting PageSize for paging

Grid View - Sorting

Enable AllowPaging property to true Column headers are rendered as links for sorting

the data in ascending or descending order

When using explicitly specified fields with a GridView, such as BoundFields, you need to specify values for the fields’s SortExpression properties.

Otherwise, nothing happens when you click a header.

Grid View - Paging

Enables you to edit database data Without writing single line of code

Grid View – Editing and Deleting Data

Set AutoGenerateEditButton and AutoGenerateDeleteButton to true

Set DataKeyNames property to Primary key of the database table

UpdateCommand and DeleteCommand are to be specified in the SQLDataSource being used

BoundField—Enables you to display the value of a data item as text. CheckBoxField—Enables you to display the value of a data item as a check box. CommandField—Enables you to display links for editing, deleting, and selecting rows. ButtonField—Enables you to display the value of a data item as a button (image button, link button, or push button). HyperLinkField—Enables you to display the value of a data item as a link.

Grid View – Fields

BoundField—Display the value of data item as text. CheckBoxField—Display the value of data item as a check

box. CommandField—Enables you to display links for editing,

deleting, and selecting rows. ButtonField—Enables you to display the value of a data

item as a button HyperLinkField—Enables you to display the value of a data

item as a link. ImageField—Enables you to display the value of a data

item as an image. TemplateField—Enables you to customize the appearance

of a data item.

Grid View – Fields

Renders HTML table Displays the contents of single database record

Detail View

Display, edit, and delete data single record at a time.

Specifying custom columns and styles. Adding your own code to the functionality of

the control by handling events.

Detail View

DatasourceID Bind to datasource control

DataSource Bind to various objects

Datasets Data tables Collections

Detail View - Data binding

Detail View - Data binding using DatasourceID

Detail View - Data binding using DataSource

Client Side Code

Server Side Code

Similar to Detail View. Template Driven

Form View

Form View - Data binding using DatasourceID

Entirely template driven Produces list of individual items The control repeats the layout for each item in

the data source.

Repeater

Repeater- Data binding using DatasourceID

Repeater- Templates

ItemTemplate —Formats each item from the data source.

AlternatingItemTemplate—Formats every other item from the data source.

SeparatorTemplate—Formats between each item from the data source.

HeaderTemplate—Formats before all items from the data source.

FooterTemplate—Formats after all items from the data source.

Entirely template driven Renders HTML table Supply the control with an ItemTemplate. The contents of the ItemTemplate are rendered

for each data item from the data source.

DataList

The RepeateLayout Property Table – Data Items are rendered in HTML Table cells Flow - – Data Items are rendered in HTML Span tags

Render contents in Multi- Column table RepeatColumns – No of columns RepeatDirection – Direction of repeat

(Horizontal/Vertical) Editing in DataList is different, it requires

programmatic approach

DataList

Super flexible GridView Control Entirely Template Driven Used to display, edit, delete and sort database

data Displays database records in multiple columns Similar to the DataList and Repeater controls Unlike those controls, with the ListView control

you can enable users to edit, insert, and delete data, and to sort and page data, all without code.

You can group items using Group Template

List View

Learn and prepare document for Standard Controls Difference between data controls Implement a Grid View using

DatasourceID DataSource

Implement Edit/Delete and Sort/Paging functionality in Grid View

Explore events of Grid View Implement simple functionality of all controls listed in

this ppt