Gridview in asp net c#
In this article I will explain what is gridview in asp net? In my next article I will explain how to display data in grid view using asp net gridview examples.
Gridview is a control which can displays the values of data source in a tabular format where each column represents a header field and each row represents a values. Asp net GridView control enables you to display, Sort and edit data. Using Gridview in asp net C# you could display complete data, you could perform sorting and paging.Gridview in asp net not only display the entire data grid view control can used to insert, delete and update data. Gridview in asp net enables you to easily connect to database.
Following are some basic but useful properties
Grid view Controls Behavior
|AllowPaging||True or False. It shows whether the control should support paging.|
|AllowSorting||True or False. Indicate whether the control should support page sorting.|
|SortExpression||Obtain the current sort expression that shows the order of the row.|
|SortDirection||Direction of sort (ascending or descending )|
|DataSource||Data source object that consist of the data.|
|AutoGenerateEditButton||True or False. Indicates whether a different column should be attach to edit the record.|
|AutoGenerateDeleteButton||True or False. Indicates whether another column should be insert to delete the record.|
|AlternatingRowStyle||This property indicate style of every alternate row in asp net gridview|
|EditRowStyle||This style is used to edit row in edit view|
|RowStyle||This property indicate style of the rows in GridView.|
|PagerStyle||If AllowPaging is true then this Defines Pager of the GridView|
|EmptyDataRowStyle||This property mostly worked when there is no data.|
|HeaderStyle||It is used to indicate style properties of the header of the asp net GridView.|
|FooterStyle||It is used to indicate style properties of the footer of the asp net GridView.|
Indicates the area in pixel between the cells and border of the GridView.
|CellSpacing||Indicates the area in pixel between the cells.|
It Indicates whether Lines should require or not, if yes then Horizontal, Vertical or Both.
|HorizontalAlign||It shows the horizontal range of the GridView.|
|ShowFooter||Define whether the footer should require or not.|
|ShowHeader||Define whether the Header should require or not.|
|BackImageUrl||It received URL of image which will shown in back ground.|
State for Grid View Control
|Columns||All collected objects are represent using columns.|
|FooterRow||Indicate gridview object which is appear in footer in asp net gridview.|
|HeaderRow||Gives a GridViewRow object that shown the header of the GridView.|
|PageCount||Gets the total number of the pages required to show the records of the data source.|
|Rows||Obtain a collection of GridViewRow objects that represents the currently appears rows in the GridView.|
|DataKeyNames||Primary key for gridview.|
|DataKeys||Collection of Data Key that represent the value of the primary key set in Data Key Names of GridView.|
Events in GridView Control
|PageIndexChanging, PageIndexChanged||PageIndexChanging and PageIndexChanged events occur when the page link is fired. They launch before and after Grid View handles.|
|RowCancelingEdit||This event is launches when Cancel button is fired in edit mode of asp net grid view.|
|RowCommand||This event is fires when a clicked on any row of asp net GridView.|
|RowCreated||This event occur when a new row is produce in GridView.|
|RowDataBound||This event fire when row is bound to the data in GridView.|
|RowDeleting,RowDeleted||RowDeleting and RowDeleted both are fires when Delete button is clicked. They launch before and after Grid View handles deleting work of the row respectively.|
|RowEditing||Its perform when a Edit button is clicked but before the Edit operation.|
|RowUpdating, RowUpdated||RowUpdating and RowUpdated both events fire when a update is clicked. They fire before and after update operation respectively.|
This is basic information of asp net gridview.In next Part I will explain how to display data in gridview using asp net GridView Tutorial.
GridView Control Example,Events of GridView,GridView Samples,
“Technicgang Started on 2015” Rahul Samant is the founder & CEO of Technicgang. A blog based on science and technology. Techicgang receives 10K subscribers with in year.