How to remove "Page Size" dropdown

44 posts, 0 answers
  1. ksuh
    ksuh avatar
    44 posts
    Member since:
    Jul 2006

    Posted 15 Apr 2009 Link to this post

    I do not want this combobox to appear.  How do I remove it?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Apr 2009 Link to this post

    Hi Ksuh,

    Try the following code snippet to achieve the desired scenario.

    CS:
     
     
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
          
            if (e.Item is GridPagerItem) 
            { 
                GridPagerItem pager = (GridPagerItem)e.Item; 
                RadComboBox PageSizeComboBox = (RadComboBox)pager.FindControl("PageSizeComboBox"); 
                PageSizeComboBox.Visible = false
            } 
        } 


    Shinu
  3. Daniel
    Admin
    Daniel avatar
    4950 posts

    Posted 16 Apr 2009 Link to this post

    Hello Kwang,

    You may easily remove it using CSS:
    .rgAdvPart 
        displaynone

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. ksuh
    ksuh avatar
    44 posts
    Member since:
    Jul 2006

    Posted 17 Apr 2009 Link to this post

    Fan-freaking-tastic.  Both solutions are total hacks.

    I guess I'll have to wait another year for someone at Telerik to put in a "ShowPageSize" attribute.
  5. Daniel
    Admin
    Daniel avatar
    4950 posts

    Posted 17 Apr 2009 Link to this post

    Hello Kwang,

    We appreciate your opinion. Our developers will consider your idea to expose a  property as you suggested.

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. ksuh
    ksuh avatar
    44 posts
    Member since:
    Jul 2006

    Posted 29 May 2009 Link to this post

    I see that this is still not done for the latest release.  Is there an ETA for this?
  7. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 02 Jun 2009 Link to this post

    Hello Kwang,

    The PagerStyle Modes, which are available out-of-the-box, offer predefined pager layout and content. We have evaluated your request, but I am afraid we do not intend to introduce properties to further customize these predefined pager modes. In order to hide the combobox, please use the one of the approaches provided above or customize the pager, according to the online examples and help articles:

    Pager Template Demo
    Pager Template Help Article

    Programmatic Pager Customization Demo
    Programmatic Pager Customization Help Article


    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 09 Jun 2009 Link to this post

    Hello Daniel,

    It would have be nice to have each pager block of the Advanced Part to get identified by a specific className.

    Sure by doing

    .rgAdvPart { displaynone; } 

    We would hide the Page Size drop down, but in NextPrevNumericAndAdvanced mode, the page navigator would also get hidden.

    Now we can't simply hide the desired part because if you try to do
    .rgPager .rgAdvPart .rgPagerLabel,  
    .rgPager .rgAdvPart .rgPagerButton  
    {  
        displaynone;  
    both content would get hidden.

    Ok I can still use a Pager Template but it would require to go through all my grids ...
    and what I what is just o hide this page size stuff :-(

    Any feedback on that would be appreciated.

    Thanks.
  9. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 09 Jun 2009 Link to this post

    Hi Grendizer,

    Actually the RadGrid pager has a unique CSS class, which corresponds to the Pager Mode. So in order to hide the RadComboBox and its label only in the NextPrevAndNumeric pager mode, you can use:

    .NextPrevAndNumeric  .rgAdvPart { display: none; }


    Greetings,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 09 Jun 2009 Link to this post

    Hello Dimo,

    Thanks for your quick update.

    I'm sorry if I was not clear enough but my issue is not related to a specific mode ... in fact, my issue is more about dealing with content of this rgAdvPart element.

    I would like to hide the Page Size block but to keep the Page Goto block, and by doing it with provided CSS  would hide everything.

    Thanks.

    Seb
  11. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 09 Jun 2009 Link to this post

    Hello Grendizer,

    Now I see. Well, in order to accomplish that, you must use a programmatic approach and set Visible="false" to the following controls:

    ChangePageSizeLabel
    ChangePageSizeTextBox
    ChangePageSizeLinkButton

    (these are the IDs which can be used by the FindControl method)


    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  12. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 09 Jun 2009 Link to this post

    Thanks for your quick update.

    Do you have any pattern to do this globally once for all grids or do I have to do it for every instance of the grid ?!

    If I have to do it for every grids, is it much appropriate than doing a custom pager template based on existing one ?!

    Regards.
  13. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 09 Jun 2009 Link to this post

    Hi Grendizer,

    Since the customization has to be carried out at runtime, naturally, it has to be implemented for every RadGrid control. In this case (re)using a pager template is better.

    Best wishes,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  14. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 09 Jun 2009 Link to this post

    Dimo,

    Thanks for your support, I'll try to handle it this way.

    Regards.
  15. Mink
    Mink avatar
    57 posts
    Member since:
    Apr 2009

    Posted 17 Jul 2009 Link to this post

    Hi Dimo,

    I can understand your position on having a couple of predefined PagerStyle Modes on one hand and the possibility of defining your own pager template on the other. However, making a template that is for example exactly the same as NextPrevAndNumeric but only without the page size controls seems a bit to much work for such a simple wish.

    Now if you'd want something done as simple as that you could of course use the css trick .rgAdvPart{ display:none;} as described by Daniel, but as other pointed out such a simple solution does not work for other slightly more complicated situations.
    For me, I wouldn't expect NextPrevAndNumeric to contain something "advanced" such as the ability to choose the page size, since there is also the NextPrevNumericAndAdvanced mode. I would say that the difference between both is the advanced part and seeing as choosing the page size is advanced it should be part of the none-advanced NextPrevAndNumeric.

    Maybe a good in between solution would be to offer a few more out-of-the-box PagerStyle Modes. For example one that's exactly like NextPrevAndNumeric but without the page size choosing bit.

    Regards,

    Mink
  16. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 17 Jul 2009 Link to this post

    Hi Mink,

    Thank you for sharing your opinion. We might consider adding more pager modes in the future.

    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  17. Jeff Reinhardt
    Jeff Reinhardt avatar
    55 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    In the ItemCreated this works to hide the Page Size Combo:

     


    if

     

    (e.Item is GridPagerItem)

     

    {

     

    GridPagerItem pagerItem = (GridPagerItem)e.Item;

     

     

    RadComboBox PageSizeComboBox = (RadComboBox)pagerItem.FindControl("PageSizeComboBox");

     

    PageSizeComboBox.Visible =

    false;

     

    }

    but the LABEL is still there.     Page Size:     sitting there in the header and footer of the grid.

    How can I remove it?

  18. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Oct 2009 Link to this post

    Hello Jeff,

    The PageSize label can be accessed by using its Control id, which is, ChangePageSizeLabel  and passing the id over in the FindControl method. take a look at the code below:
    c#:
     protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if(e.Item is GridPagerItem) 
            { 
                GridPagerItem pagerItem = (GridPagerItem)e.Item; 
                RadComboBox PageSizeComboBox = (RadComboBox)pagerItem.FindControl("PageSizeComboBox"); 
                PageSizeComboBox.Visible = false
                Label changePageSizelbl = (Label)pagerItem.FindControl("ChangePageSizeLabel"); 
                changePageSizelbl.Visible = false
            } 
        } 

    Thanks
    Princy.
  19. Waqas Akram
    Waqas Akram avatar
    1 posts
    Member since:
    Aug 2009

    Posted 23 Oct 2009 Link to this post

    That's cool... Works for us... Thanks for the post
  20. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 25 Oct 2009 Link to this post

    Hi,
    Supporting a fixed set of modes with layouts is fine. It would be nice to have more of these modes though. The thing that annoyed me is that between versions you added a new control to an existing layout. You should have create a new mode for the new controls (page size). This has made existing code not work as designed. You should avoid these breaking changes where possible.
    Clayton
  21. Rebecca Rasmussen
    Rebecca Rasmussen avatar
    20 posts
    Member since:
    Mar 2007

    Posted 28 Dec 2009 Link to this post

    "between versions you added a new control to an existing layout. ... [please also] create a new mode for the new controls (page size)

    I second this concept. I recently upgraded to 2009 q3 from a 2008 version, and voila, now I'm having to go in a remove the new page control from the pager in all of my grids (because we have a single page-size control in our footer that affects all grids in our application as our users wanted to be able to set this once and be done).

    Very painful!

    It would be swell if when you add a new control to an existing item you also make it very easy to hide for those that are happy with the existing layout and do not want to utilize the new control. :)
  22. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 28 Dec 2009 Link to this post

    Hello Rebecca,

    The easiest way to remove the dropdown is with a CSS rule:

    .NextPrevAndNumeric  .rgAdvPart { display: none; }

    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  23. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 28 Dec 2009 Link to this post

    Hi,
    The point here is not how to implement a work around. But that you should not make breaking changes when not absolutely necessary.
    Clayton
  24. Toby
    Toby avatar
    59 posts
    Member since:
    Jul 2009

    Posted 17 Feb 2010 Link to this post

    Just to say I completely agree with ksuh, there should just be a property whether to show the pagesize combo or not, which is how it is done on most of grid controls. Its not like its something that is going to be complicated to add for the developers either.

    thanks
    Toby
  25. Neil
    Neil avatar
    3 posts
    Member since:
    Apr 2006

    Posted 08 Apr 2010 Link to this post

    This feature appeared out of nowhere, and is stuck (unless you hack it off).  Why is Telerik so against giving a more legit solution to not show the Change Page Size drop down?!!   It doesn't always work anyway. 

    You've already told us there's a CSS and code-behind way to "remove" it.   So please stop repetitively posting it like it's what we've been asking for.
  26. Dimo
    Admin
    Dimo avatar
    8340 posts

    Posted 09 Apr 2010 Link to this post

    Hello Neil,

    We understand that the predefined pager layouts may not suite all scenarios and developers, but our goal is to keep them as simple (in terms of configuration and implementation) as possible.

    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.
  27. Manuel Romero
    Manuel Romero avatar
    1 posts
    Member since:
    Feb 2008

    Posted 08 Sep 2011 Link to this post

    Having controls cluttered with features that cannot easily be turned off with properties does not make them "simple". It makes them harder to work with.
  28. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 01 May 2012 Link to this post

    Is this fixed yet?

    I should be be able to hide the Page Size combo box with either a PagerStyle or MasterTableView setting.
  29. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 03 May 2012 Link to this post

    Peter:

    This was not a bug in RadGrid, so it did not require fixing.

    Here's the method that can be used for hiding the PageSize combo box  and the associated label:

        protected void RadGrid1_ItemDataBound1(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;
            }
     
        }
     
    }

    More detail is available in this forum thread.

    Hope this helps!
  30. ksuh
    ksuh avatar
    44 posts
    Member since:
    Jul 2006

    Posted 03 May 2012 Link to this post

    Well I guess this "feature" is still bothering a lot of people.

    It is not a bug.  However, it was an unexpected change in behaviour that some people, including myself, found no use for when the current previous implementation was the one that was wanted.

    Your solution is a hack.  I have around 30 grids I have to apply this "fix" for.  It is a maintenance annoyance, not to mention that this needs to be done every new grid that gets created. 
Back to Top