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

Client-Side paging not working in telerik radgrid

4 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jagz W
Top achievements
Rank 2
Jagz W asked on 13 Sep 2012, 09:49 AM

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.

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 17 Sep 2012, 03:33 PM
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.
0
Jagz W
Top achievements
Rank 2
answered on 20 Sep 2012, 10:56 AM
Hi Eyup,

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


0
Eyup
Telerik team
answered on 24 Sep 2012, 03:44 PM
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.
0
Jagz W
Top achievements
Rank 2
answered on 25 Sep 2012, 03:22 AM
Hi Eyup,

I have used _setPagerVisibility(false) property of radgrid.

if (total <= 5) {
   var tableView = $find("<%= grid1.ClientID %>").get_masterTableView();
    tableView._setPagerVisibility(false);
}
Tags
Grid
Asked by
Jagz W
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Jagz W
Top achievements
Rank 2
Share this question
or