Showing posts with label Gridview. Show all posts
Showing posts with label Gridview. Show all posts

Sunday, September 10, 2017

Get count of rows and columns from datatable in asp.net

In this article I am going how to get count of rows and columns from datatable in asp.net.

Implementation:
I want to know how many rows and columns in datatable or dataset?

Syntax
C# code

int row = dt.Rows.Count;
int column = dt.Columns.Count;
//dataset row count
  int row = ds.Tables[0].Rows.Count;
  int column = ds.Tables[0].Columns.Count;

VB.net code

Dim row As Integer = dt.Rows.Count
Dim column As Integer = dt.Columns.Count
dataset row count
Dim row As Integer = ds.Tables(0).Rows.Count
Dim column As Integer = ds.Tables(0).Columns.Count

Example:
HTML Markup of webform

Saturday, September 9, 2017

Asp.net Gridview : Replace null or empty value with default message

In this article I am going to explain how to replace null or empty value with default message such as “-NA-“or “Data not available” in asp.net Gridview.

Description:
I am showing list of Employees in gridview data control. Some of columns are empty. I want to show a default message “-NA-“instead of empty column.

  
Implementation:

Wednesday, September 6, 2017

Different approaches to change Gridview row color on mousehover in asp.net

In this article I am going to explain different approaches to change Gridview row color on mousehover in asp.net.

Description:
I am showing employees detail in Gridview data control. I want to change the color of row on mousehover.


Implementation:
We have many approaches to change the row color on mousehover code behind, through CSS and javascript.

HTML Markup of webform:

Sunday, September 3, 2017

Asp.net Gridview: Change row color on mousehover

In this article I am going to explain how to change Gridview row color on mousehover in asp.net.

Description:
I am showing employees detail in Gridview data control. I want to change the color of row on mousehover.


Implementation:
We have many approaches to change the row color on mousehover code behind, through CSS and javascript.

HTML Markup of webform:

Saturday, August 19, 2017

Asp.net : Display tooltip in Gridview column on mouseover

In this article I am going to explain how to display tooltip in Gridview column on mouseover in asp.net. 

Description:
I am displaying employee’s information in Gridview and want to display each column data when placed mouse on column. We have 2 options 1st write  code on RowDataBound event of Gridview and 2nd use the label control’s tooltip property.

Implementation:
Method 1:

Complete source of webform