JG Vimalan's Blog

It is all about coding!

Get the number of rows in GridView using JavaScript

The following code snippet will give an idea of accessing number of rows in a gridview from javascript.

<script type=”text/javascript”>
window.onload = function() {

var grid = document.getElementById(‘ctl00_mainContentPlaceHolder_myGridView’);
//number of rows in gridview

var rowCount = grid.rows.length – 1;    //grid rows include header
if (grid != null && rowCount <6)//grid rows include header
{


}

}
</script>

Advertisements

September 30, 2010 - Posted by | JavaScript

1 Comment »

  1. good. can we get the columns count?

    Comment by gage | April 20, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: