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

Show/Hide or enable/disable paging

5 Answers 632 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 16 Apr 2012, 12:00 PM
Hi,

Can you help me to figure out how to show hide or enable disable paging on the client? I'm trying to hide or disable the paging bar at the bottom of the page when searching. I attached a image to give you an idea. When returning search results I want results without paging.

Thanks,
Ron.

5 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2012, 01:39 PM
Hello Ron,

you can hide pagging by below code snippet.
var RadGrid1 = $find("<%=RadGrid1.ClientID %>");
              $('.rgPager').attr("style", "display: none;");

and

you can show pagging by below code snippet.
var RadGrid1 = $find("<%=RadGrid1.ClientID %>");
              $('.rgPager').attr("style", "display: '';");


Thanks,
Jayesh Goyani
0
Ron
Top achievements
Rank 1
answered on 16 Apr 2012, 03:00 PM
Jayesh,

Thanks for your help on this one but I'm receiving an error. Are you sure the syntax is correct? I'm getting an "object expected" error.
I attached a screen of it so you can take a look. Thanks again.
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2012, 04:03 PM
Hello Ron,

Please add Jquery file in your project/page.

<head runat="server">
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
............
..............


Note : you can download jquery file from below link.
http://docs.jquery.com/Downloading_jQuery

I already tested above (JS) code its working correctly on my side..

Thanks,
Jayesh Goyani
0
Ron
Top achievements
Rank 1
answered on 16 Apr 2012, 05:20 PM
Jayesh,

Once again thanks! That worked, just one problem. When clearing the search or the search criteria and returning to normal mode paging isn't quite right. I'll explain...Say you search for the word "blue" and you get your results then you want to return all results so you clear the search box and click enter. Everything returns fine but the page size is set to 50 but the grid is displaying results beyond 50. I explicitly set the grid pageSize property to 50 and it shows 50 in the pagination bar but the grid shows more. What's even more interesting is my icons in the grid stop and 50 but the results continue without the icons. I attached an image to clearify.
if (searchValue != "") {
                    var RadGrid1 = $find("<%=grdInvoices1.ClientID %>");
                    $('.rgPager').attr("style", "display: none;");
                }
                else {
                    var RadGrid1 = $find("<%=grdInvoices1.ClientID %>");
                    $('.rgPager').attr("style", "display: '';");
 
                   RadGrid1.MasterTableView.set_pageSize(pageSize);
                }


Thanks,
Ron.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Apr 2012, 07:20 AM
Hello Ron,

Please check below link.
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html

and after trigger the firecommand from client side.
you can get this event on server side.

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.PageCommandName)
        {
            // set your page size here
        }
}


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Ron
Top achievements
Rank 1
Share this question
or