How to get total page in gridview pagination?

Hi everyone,

How can we get total page count in gridview pagination? for example i have a gridview with 15 record and i want to set limit per page to 7 so i will have 3 page in pagination. but how can i get total page in pagination to create looping in javascript ?


<?php 

        $pagesize = $dataProvider->pagination->pageSize;// it will give Per Page data. 

        $total = $dataProvider->totalCount; //total records // 15 

        echo (int) (($total + $pagesize - 1) / $pagesize); 

?>

Mark + if solved.