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

Removing Page Size control From RadGrid

14 Answers 1686 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tristan
Top achievements
Rank 1
Tristan asked on 05 Jun 2009, 01:47 AM
Hi Guys,

We'd been using RadGrid for awhile version Q3 2008. We've recently updated it to Q1 2009_1_527 .

We've noticed some changes and one of it is the "page size" control(dropdownlist) appears in the footer of the RadGrid if the pagerstyle mode is set to "NextPrevAndNumeric". Is there any way to remove this "page size" control as we don't actually need it as most of our RadGrid already has its own "page size" control.

I try to read the documentation but there don't seem to be an explanation how this could be done.

14 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 Jun 2009, 03:52 AM
Hi Tristan,

Try adding following CSS in order to hide the pagesize dropdown in grid.

CSS:
 
<style type="text/css">      
   div.RadGrid .rgPager .rgAdvPart     
   {     
    display:none;        
   }      
</style>  

-Shinu.

0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Jun 2009, 03:59 AM
Hello Tristan,

You can also try out the following code to remove the pagesize dropdown:
c#:
    protected void RadGrid1_ItemDataBound (object sender, GridItemEventArgs e) 
    {   
      if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pager = (GridPagerItem)e.Item;           
            Label lbl = (Label)pager.FindControl("ChangePageSizeLabel"); 
            lbl.Visible = false
             
            RadComboBox combo = (RadComboBox)pager.FindControl("PageSizeComboBox"); 
            combo.Visible = false
        } 
      } 

Thanks
Princy.
0
Tristan
Top achievements
Rank 1
answered on 05 Jun 2009, 04:38 AM
Hi Shinu, Princy

The CSS solution works!
i haven't tested the code behind solution yet
0
Jason Hansen
Top achievements
Rank 1
answered on 08 Jun 2010, 08:46 PM
Hi Princy,

The code version works, too. ;)

thanks for the help!
jason

0
Bob
Top achievements
Rank 1
answered on 29 Jun 2010, 05:53 PM
Hello Telerik Team,

Please update your documentation (or code) to agree with one another.  This is an annoying problem since the documentation claims NextPrevAndNumeric work differently than they actually do..(BTW, I am using the latest version 2010.1.530.35)

Bob

0
Dimo
Telerik team
answered on 30 Jun 2010, 03:08 PM
Hello Bob,

Could you please be more specific what discrepancy you are referring to? Is it something on this page?

http://www.telerik.com/help/aspnet-ajax/grdpageritem.html

Greetings,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bob
Top achievements
Rank 1
answered on 30 Jun 2010, 04:00 PM
See attached screenshot of CHM file documentation

It states that PrevNextAndNumeric does NOT show the page size controls


0
Dimo
Telerik team
answered on 01 Jul 2010, 08:10 AM
Hello Bob,

Thank you, we will edit the text.

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wired_Nerve
Top achievements
Rank 2
answered on 16 Oct 2012, 03:00 PM
The code solution works really well (easy) because we have grids with grids inline and trying to figure out how to get the style sheet method to apply to grids with inner grids just was not working...

0
Shinu
Top achievements
Rank 2
answered on 17 Oct 2012, 09:27 AM
Hi,

I suppose you are using NestedViewTemplate. Here is the sample code that I tried which worked as expected.
aspx:
<style type="text/css">     
   div.RadGrid .rgPager .rgAdvPart    
   {    
    display:none;       
   }     
</style
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" PageSize="3" DataSourceID="SqlDataSource2" >
 <MasterTableView CommandItemDisplay="Top" HierarchyDefaultExpanded="true">
    <Columns>
     . . .
    </Columns>
 <NestedViewTemplate>
     <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="false"  AllowPaging="true" PageSize="3" DataSourceID="SqlDataSource2" >
       <MasterTableView>
         <Columns>
             . . .
         </Columns>
       </MasterTableView>
     </telerik:RadGrid>
 </NestedViewTemplate>
 </MasterTableView>
</telerik:RadGrid>

Thanks,
Shinu.
0
Wired_Nerve
Top achievements
Rank 2
answered on 17 Oct 2012, 12:23 PM
While the stylesheet method works, it ends up applying the style to all the grids on a refresh.  Our inner grids are actually user controls nested in a temple of a parent grid.
The first time the grid loads on the page everything is perfect.  The parent grid offers the user the chance to change the PAGE SIZE of the parent grid (5, 15, 25, 100) and the child grid does not offer a PAGE SIZE COMBO change option.  Perfect, once the person changes the parent page size or moves to another page.. It disappears for all the grids on that page...

So in the end, using the code approach was much easier than trying to figure out the css for isolating the inner grid...
0
Angel Petrov
Telerik team
answered on 19 Oct 2012, 02:44 PM
Hi Warren,

Indeed using the server-side logic is the preferable solution when hiding elements. The CSS classes if not used with a particular ID would be applied for all elements with that class on the page.

Regards,
Angel Petrov
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
WEBSRFR
Top achievements
Rank 1
answered on 19 Jan 2015, 12:42 AM
I must have read dozens of posts about this topic and I was wondering in the latest iteration of the controls if there is a way to programmatically turn off this drop down box of different page sizes. Seems like a much better way to address the needs of many users rather than add extraneous code. to disable this "feature."
0
WEBSRFR
Top achievements
Rank 1
answered on 19 Jan 2015, 02:32 AM
On another thread I found a solution to this.

<PagerStyle PageSizeControlType="None" />

..The above tag turns off the page size dropdown "feature."
Tags
Grid
Asked by
Tristan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Tristan
Top achievements
Rank 1
Jason Hansen
Top achievements
Rank 1
Bob
Top achievements
Rank 1
Dimo
Telerik team
Wired_Nerve
Top achievements
Rank 2
Angel Petrov
Telerik team
WEBSRFR
Top achievements
Rank 1
Share this question
or