Docsity

Data Grids - Internet Programming - Lecture Slides, Slides of Computer Programming

Partial preview of the text

Download Data Grids - Internet Programming - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

Creating Bindable Grids

of Data

Lecture Overview

 Detailed discussion of using the GridView

Setting Column Properties

(Introduction)

 Columns can be set using the wizard (see following screen shot)  Columns can be managed using the .aspx code  Or programmatically

Setting Column Properties

(Illustration)

Complementary GridView

Controls

ListView uses templates to display data  Insert, update, delete supported  DetailsView displays a single row from a data source  Insert, update delete supported  More in the next lecture

GridView (Binding)

DataSource and DataMember control define the control’s source of data  Or use the DataSourceID  The value of DataSourceID should be an AccessDataSource or other SqlDataSource

GridView (Sorting Columns)

 Simply put, you set the AllowSorting property to true  The underlying data source handles the sorting  The column header appears as a link button  Set the SortDirection property to Ascending or Descending  For each bound field, set the sortexpression attribute to the field or expression that will be evaluated

GridView (Captions)

Caption – appears above the grid headers  CaptionAlign – controls the alignment of the caption  Captions can appear along the left, top, right, or bottom of the grid  ShowHeader and ShowFooter – display the header or footer  Note the caption appears in the header

GridView (Paging 1)

 Paging provides the facility that enables the DataSet to be displayed in pages having a fixed length  This keeps the Web page from getting too long  Reduces page size thereby improving download times

GridView (Paging)

AllowPaging (false) – controls whether data appears on multiple pages  PageSize - defines the number of items (rows) per page  The above are both members of the grid itself

PageIndex – gets the current page being displayed  PageCount – gets the number of pages available

GridView

( PagerSettings )

 The PagerSettings object allows you to use predefined display modes  Modes ( NextPrevious , NextPreviousFirstLast , Numeric , NumericFirstLast )  Non-numeric button customization ( FirstPageText , PreviousPageText , NextPageText , LastPageText  Or Images ( FirstPageImageURL , PreviousPageImageURL , NextPageImageURL , LastPageImageURL )

GridView (Custom Paging)

 Custom paging is supported along with custom pager styles  AllowCustomPaging – defines a custom pager

GridView (Row Styles 1)

 The following set the style of various graphical elements  RowStyle – individual items displayed in all rows  AlternatingRowStyle – every other item  EditRowStyle – the item being edited  FooterStyle – the footer appearing at the bottom of the control  HeaderStyle – the header appearing at the top of the control  SelectedRowStyle – the selected row  PagerStyle – the style of the pager area

GridView (Columns)

 Each GridView is made up of a set of Columns  The collection is a child of the GridView  Each column is considered a “field”. A column can display  bound data  predefined commands (buttons)  Hyperlinks and images  Custom templates