The GridView control is a powerful data grid control that allows you to display an entire collection of data, add sorting and paging, and perform inline editing. In addition to just displaying data, the GridView can be used to edit, select and delete the displayed data as well.
The GridView control supports the following features:-
1. Improved data source binding capabilities
2. Tabular rendering – displays data as a table
3. Item as row
4.Built-in sorting capability
5. Built-in select, edit and delete capabilities
6. Built-in paging capability
7. Built-in row selection capability
8. Multiple key fields
9. Programmatic access to the GridView object model to dynamically set properties, handle events and so on
10. Richer design-time capabilities
11.Control over Alternate item, Header, Footer, Colors, font, borders, and so on.
12. Slow performance as compared to Repeater and DataList control
Properties of GridView Control:
Following are some important properties that are very useful.
Behaviour Properties of the GridView Control
AllowPaging:-
true/false. Indicate whether the control should support paging.
AllowSorting:-
true/false. Indicate whether the control should support sorting.
SortExpression:-
Gets the current sort expression (field name) that determines the order of the row.
SortDirection:-
Gets the sorting direction of the column sorted currently (Ascending/Descending).
DataSource:-
Gets or sets the data source object that contains the data to populate the control.
DataSourceID:-
Indicate the bound data source control to use (Generally used when we are using SqlDataSource, ObjectDataSource, or AccessDataSource to bind the data).
AutoGenerateEditButton:-
true/false. Indicates whether a separate column should be added to edit the record. The default is false.
AutoGenerateDeleteButton:-
true/false. Indicates whether a separate column should be added to delete the record. The default is false.
AutoGenerateSelectButton
true/false. Indicate whether a separate column should be added to select a particular record. The default is false.
AutoGenerateColumns:-
true/false. Indicate whether columns are automatically created for each field of the data source. The default is true.
Style Properties of the GridView Control
AlternatingRowStyle:-
Defines the style properties for every alternate row in the GridView.
EditRowStyle:-
Defines the style properties for the row in Edit View (When you click Edit button for a row, the row will appear in this style
RowStyle:-
Defines the style properties of the rows of the GridView.
PagerStyle:-
Defines the style properties of Pager of the GridView. (If AllowPaging=true, the page number row appears in this style
EmptyDataRowStyle:-
Defines the style properties of the empty row, which appears if there is no records in the data source.
HeaderStyle:-
Defines the style properties of the header of the GridView. (The column header appears in this style.)
FooterStyle:-
Defines the style properties of the footer of GridView.
Events associated with GridView Control:
PageIndexChanging, PageIndexChanged:-
Both events occur when the page link is clicked. They fire before and after GridView handles the paging operation respectively.
RowCancelingEdit:-
Fires when Cancel button is clicked in Edit mode of GridView.
RowCommand:-
Fires when a button is clicked on any row of GridView.
RowCreated:-
Fires when a new row is created in GridView.
RowDataBound:-
Fires when row is bound to the data in GridView.
RowDeleting, RowDeleted:-
Both events fires when Delete button of a row is clicked. They fire before and after GridView handles deleting operation of the row respectively.
RowEditing:-
Fires when an Edit button of a row is clicked but before the GridView handles the Edit operation.
RowUpdating, RowUpdated:-
Both events fire when an update button of a row is clicked. They fire before and after GridView control update operation respectively.
Sorting, Sorted:-
Both events fire when column header link is clicked. They fire before and after the GridView handler the Sort operation respectively.
This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Dot Net Training in Chennai. or learn thru ASP.NET Online Training . Nowadays Dot Net has tons of job opportunities on various vertical industry.
ReplyDeleteThis is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry.