BigRoz Big Roz
Home / Technology / ASP.net / Gridview in asp net c# | asp net gridview

Gridview in asp net c# | asp net gridview

Gridview in asp net c#

Introduction

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.

Description: 

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.

Properties:

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.

 Style Properties

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.

Appearance Properties

CellPadding Indicate

Indicates the area in pixel between the cells and border of the GridView.

CellSpacing Indicates the area in pixel between the cells.
GridLines Following Option:

Both

Horizontal

Vertical

None.

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.

 

 Upcoming

GridView Control Example,Events of GridView,GridView Samples,

 

 

 

 

Author: Technicgang

“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.

About Technicgang

"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.

Leave a Reply

9 Comments on "Gridview in asp net c# | asp net gridview"

Notify of
Sort by:   newest | oldest | most voted

Remarkable! Its in fact amazing piece of writing, I have got much clear idea about gridview.

I think the admin of this site is in fact working hard for his
website, as here every data is quality based information.

Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact
enjoyed account your blog posts. Anyway I will be subscribing
to your augment and even I achievement you access consistently quickly.

I’m excited to find this page. I wanted to thank you for your time due to this wonderful read!!

I definitely appreciated every part of it and I have you saved as a
favorite to check out new stuff on your site.

Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog?
My website is in the exact same niche as yours and my users would truly benefit from a lot of the information you present here.
Please let me know if this okay with you. Thanks!

I like what you guys tend to be up too. This kind of clever
work and exposure! Keep up the fantastic works guys I’ve added you guys to my personal blogroll.

I wanted to thank you for this great read!! I absolutely loved every bit of it.
I have you saved as a favorite to check out new stuff you post…

Google

Here is a good Blog You might Discover Fascinating that we encourage you to visit.

Very informative content

wpDiscuz