How to select a row in gridview

The GridView control is used to display the values of a data source in a table. One of the key advantages of the GridView control over other data-bound controls is its ability to automatically take advantage of data source capabilities. In some situation we need to select an entire row values for different puposes. The following lesson will explian how you can select an entire row from a GridView and retrieve the data from the GridView row.

How to get selected row values from a Gridview control

how to select a row in gridview


In this article I have used Microsoft's Pubs database for sample data. You can download it free from the following link.


Gridview Select Row Without Using SELECT Button

You can Highlight a Row in GridView by using the onmouseover event. The following code will color the GridView row while mouse overing.

How to get selected row values from a Gridview control

You can catch the GridView Cell value at the OnSelectedIndexChanged event. The following code retrieve the Cell Value from GridView OnSelectedIndexChanged event.

The following source code will highlight GridView row on mouse over and select Cell value on Click event.


C# Source Code

VB.Net Source Code (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About