Row count of all pages in grid client side

3 posts, 0 answers
  1. Sunny
    Sunny avatar
    18 posts
    Member since:
    Jan 2007

    Posted 18 Mar 2010 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Mar 2010 Link to this post

    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
  3. Philippe GRACA
    Philippe GRACA avatar
    35 posts
    Member since:
    Nov 2003

    Posted 13 Dec 2017 in reply to Princy Link to this post

    Hi

    If paging is enabled

     

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

     

Back to Top