Removing Page Size control From RadGrid

15 posts, 2 answers
  1. Tristan
    Tristan avatar
    2 posts
    Member since:
    Feb 2008

    Posted 04 Jun 2009 Link to this post

    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.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Jun 2009 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Jun 2009 Link to this post

    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.
  5. Tristan
    Tristan avatar
    2 posts
    Member since:
    Feb 2008

    Posted 04 Jun 2009 Link to this post

    Hi Shinu, Princy

    The CSS solution works!
    i haven't tested the code behind solution yet
  6. Jason Hansen
    Jason Hansen avatar
    2 posts
    Member since:
    Feb 2010

    Posted 08 Jun 2010 Link to this post

    Hi Princy,

    The code version works, too. ;)

    thanks for the help!
    jason

  7. Bob
    Bob avatar
    28 posts
    Member since:
    Jul 2009

    Posted 29 Jun 2010 Link to this post

    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

  8. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 30 Jun 2010 Link to this post

    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
  9. Bob
    Bob avatar
    28 posts
    Member since:
    Jul 2009

    Posted 30 Jun 2010 Link to this post

    See attached screenshot of CHM file documentation

    It states that PrevNextAndNumeric does NOT show the page size controls


  10. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 01 Jul 2010 Link to this post

    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
  11. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 16 Oct 2012 Link to this post

    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...

  12. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Oct 2012 Link to this post

    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.
  13. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 17 Oct 2012 Link to this post

    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...
  14. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 19 Oct 2012 Link to this post

    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.
  15. WEBSRFR
    WEBSRFR avatar
    14 posts
    Member since:
    Mar 2004

    Posted 18 Jan 2015 Link to this post

    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."
  16. WEBSRFR
    WEBSRFR avatar
    14 posts
    Member since:
    Mar 2004

    Posted 18 Jan 2015 in reply to WEBSRFR Link to this post

    On another thread I found a solution to this.

    <PagerStyle PageSizeControlType="None" />

    ..The above tag turns off the page size dropdown "feature."
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017