This is a migrated thread and some comments may be shown as answers.

Javascript Get Row Count

3 Answers 583 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 15 Sep 2008, 09:14 PM
How can I use javascript to get the number of rows returned in a grid?

var grid = $find("<%=RadGrid1.ClientID %>");       
var gridItems = grid.get_masterTableView().??????? 

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Sep 2008, 04:11 AM
Hi George,

Try the following code snippet to get the number of rows in a Grid on the client side.

JS:
 var grid = $find("<%= RadGrid1.ClientID %>"); 
 var len=grid.get_masterTableView().get_dataItems().length; 



Thanks
Shinu.
0
Mike
Top achievements
Rank 1
answered on 16 Sep 2008, 02:27 PM
That's the ticket!  Thanks!
0
Kousalya
Top achievements
Rank 1
answered on 17 Sep 2008, 11:39 AM
I have used this code
 var grid = $find("<%= RadGrid1.ClientID %>"); 
 var len=grid.get_masterTableView().get_dataItems().length; 

but i am not getting the count.

I have also tried with

var count = <%= RadGrid1.Items.Count %>;

I am getting the count, but when I add  or delete a record the count is not getting updated.

Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Kousalya
Top achievements
Rank 1
Share this question
or