Client-Side paging not working in telerik radgrid

5 posts, 0 answers
  1. Jagz W
    Jagz W avatar
    17 posts
    Member since:
    Mar 2012

    Posted 13 Sep 2012 Link to this post

    I am binding radgrid in client-side with AllowPagging="true" and page-size=5. My requirement is to hide the paging panel if there are 5 or less than 5 records (or you can say if there is only one page).

    For this i have tried PagerStyle-AlwaysVisible="true". It works well if there are 5 or less than 5 records. But if the number of records are 8 then i will display 2 page. First page displays 5 records and the second page display 3 records.

    Now, the problem is on second page it hides the paging panel because the number of records are less than 5.

  2. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 17 Sep 2012 Link to this post

    Hi Jagwinder,

    Could you please try the following approach and let me know about the result?
    function pageLoad() {
        var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();
        if (masterTable.get_virtualItemCount() <= 5) {
            masterTable.get_element().getElementsByClassName("rgPager")[0].style.display = "none";
        }
    }

    That should do the trick.

    All the best,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jagz W
    Jagz W avatar
    17 posts
    Member since:
    Mar 2012

    Posted 20 Sep 2012 Link to this post

    Hi Eyup,

    I tried this approach but it din't work. Still on page second it hide the pagging panel.   :(


  5. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 24 Sep 2012 Link to this post

    Hi Jagwinder,

    Could you please enable the AlwaysVisible property and add the following function?
      mark-up:
    <ClientEvents OnDataBound="gridBound" />
      JavaScript:
    function gridBound(sender, args) {
        var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();
        if (masterTable.get_virtualItemCount() < 5) {
            masterTable.get_element().getElementsByClassName("rgPager")[0].style.display = "none";
        }
    }

    I hope this will prove helpful.

    All the best,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Jagz W
    Jagz W avatar
    17 posts
    Member since:
    Mar 2012

    Posted 24 Sep 2012 Link to this post

    Hi Eyup,

    I have used _setPagerVisibility(false) property of radgrid.

    if (total <= 5) {
       var tableView = $find("<%= grid1.ClientID %>").get_masterTableView();
        tableView._setPagerVisibility(false);
    }
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017