You can set the RowStyle.CssClass property for gridview and count them using jQuery.
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" ...> <RowStyle CssClass="gridrow" /> </asp:GridView>
This will display the grid lines with the specified class.
<tr class="gridrow"> <td>row data here</td> </tr>
Then you can read the rows using the class selector
var rowscount = $(".gridrow").length;
source share