GridView in Asp.net:
As we know that the grid view control is very important of
every ASP.NET webpage, for displaying rows of data and allow to user to add
records, edit records and delete records. Grid is use to display data in
tabular format (in the form of rows and columns).
GridView on webpage:
Grid control with header Style:
Grid with Footer and header Style:
|Asp.net Grid with header and footer|
Gridview Constructors in Asp.net :
- Access Key: For Quick Navigation. This is inherited by Web control class.
- AllowPaging: Paging feature is enabled.
- AllowSorting: Sorting feature is enabled.
- AlternatingRowStyle: Enables you to set the appearance of alternating data rows in a Grid .
- AppRelativeTemplateSourceDirectory: Inherited from Control class.
- BackColor: Define Background color of the Web server control.
- BackImageUrl: Image to display in the background of Grid control.
Asp.Net GridView Methods:
- DataBinding: when control binds to a data source.
- DataBound: after control binds to a data source.
- Disposed: control is released from memory.
- Init: control is initialized, this is the first step in its server control lifecycle.
- Load: control is loaded into the Page object.
- PageIndexChanged: Pager buttons is clicked.
- PreRender: after the Control object is loaded but prior to rendering.
- RowCancelingEdit: Cancel button of a row in edit mode is clicked.
- RowCommand: when a button is clicked in a Grid control.
- RowCreated: when a row is created in a control Grid.
- RowDataBound : when a data row is bound to data in a GridView.
- RowDeleted: when a row's Delete button is clicked.
- RowEditing: when a row's Edit button is clicked.
- RowUpdated: when a row's Update button is clicked.
Syntax of Grid view with possible Properties and Events:
GridView control Features :
- Binding to data source controls, such as SqlDataSource.
- Multiple data fields for the hyperlink columns.
- Built-in paging capabilities.
- Built-in sort capabilities.
- Built-in row selection capabilities.
- Built-in update and delete capabilities.
- Customizable appearance through themes and styles.
- Multiple key fields.
- Programmatic access to the GridView object model to dynamically set properties.
Other Asp.net Controls:
- Label Control
- Button Control,
- ImageButton Control,
- TextBox Control,
- CheckBox Control,
- RadioButton Control.
- Example of Listview.
- Example of checkbox
- checkbox with Grid
- CheckBox List control
- ImageMap Control of Asp.net