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

Row count of all pages in grid client side

2 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Najah
Top achievements
Rank 1
Najah asked on 18 Mar 2010, 09:53 AM
Hi,

If I have multiple pages in the grid, my script gives the number of rows for the first page only.

Is there a way to count the number of rows in all the pages of the grid?
<script type="text/javascript">    
function RowCount()    
{    
    var grid = $find("<%=RadGrid1.ClientID %>");    
    var MasterTable = grid.get_masterTableView();    
    var Rows = MasterTable.get_dataItems();    
    alert(Rows.length);    
}    
</script>    
 

Thanks,
Sana

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Mar 2010, 12:01 PM
Hi,

It is not possible to access the  entire row count without chaning the page size and causing a postback.I have posted a js though that does the same .

 <script type="text/javascript" language="javascript"
   
      function GridCreated() { 
          var grid = $find("<%=RadGrid2.ClientID %>"); 
          var MasterTable = grid.get_masterTableView(); 
          var Rows = MasterTable.get_dataItems(); 
          var size = MasterTable.get_pageCount() * MasterTable.get_pageSize(); 
          if(size==MasterTable.get_pageSize()) 
              alert(Rows.length); 
              
      } 
      function RowCount() { 
            
          var grid = $find("<%=RadGrid2.ClientID %>"); 
          var MasterTable = grid.get_masterTableView(); 
          var Rows = MasterTable.get_dataItems(); 
          var size=  MasterTable.get_pageCount() * MasterTable.get_pageSize() 
          MasterTable.set_pageSize(size); 
          return false
      }  
    </script> 

Please  also refer to the link below:
http://www.telerik.com/community/forums/aspnet/treeview/passing-the-form-to-anaother-form.aspx

Princy
0
Philippe GRACA
Top achievements
Rank 1
answered on 13 Dec 2017, 08:56 AM

Hi

If paging is enabled

 

alert($('.rgInfoPart strong:last-child').text());

 

Tags
Grid
Asked by
Najah
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Philippe GRACA
Top achievements
Rank 1
Share this question
or