How to remove "Page Size" dropdown

44 posts, 0 answers
  1. Tsvetina
    Admin
    Tsvetina avatar
    1874 posts

    Posted 07 May 2012 Link to this post

    Hi,

    If you have a lot of grids and you want all of them to not display the dropdown, why not use the CSS rule suggested in one of the previous posts by Dimo:
    .NextPrevAndNumeric  .rgAdvPart { display: none; }

    You only add it once in your page's stylesheets and you do not need to do anything else to hide the page size combo in the numerous grids.

    If needed, you could make the selector(s) even more specific, so that the rule does not hide other controls if you are allowing the user to switch modes.

    Greetings,
    Tsvetina
    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.
  2. ksuh
    ksuh avatar
    44 posts
    Member since:
    Jul 2006

    Posted 07 May 2012 Link to this post

    Because the combobox is still rendered, that's why!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tsvetina
    Admin
    Tsvetina avatar
    1874 posts

    Posted 10 May 2012 Link to this post

    Hello,

    Other options are to declare a pager template as per your requirements and reuse it in the different grids, or if all your grids are identical, you can have a user control with the grid declaration and reuse it instead of adding the code-behind to hide the grid in each page.
    Anyway, if you would like this, you can submit a Feature Request through the ticketing system and post your requirement to our developement team there, so that they can again consider it or add it to PITS for voting by the community.

    Greetings,
    Tsvetina
    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.
  5. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 16 Jan 2013 Link to this post

    I see 2 solutions posted...one uses the ItemCreated method and one uses the ItemDataBound method.
    Do both work or is one the correct one to use?

    I also want to support some of the previous posts in that this type of simple behavior (to hide a Page Size dropdown) should be provided without the need to do coding using the controls names.  Will Telerik guarantee that these control names and property names will NEVER change????

    And if this Page Size was added to an existing pager-style, then I also have to agree with the previous posts that this is completely unacceptable side-affect behavior. 

    Thank you
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jan 2013 Link to this post

    Hi,

    You can access the pager controls in either ItemCreated or ItemDataBound event by using the ID's of the controls in the pager depending on each mode. Also check the following help documentation for more details.
    Accessing the Elements of Advanced Type Pager

    Thanks,
    Shinu
  7. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 17 Jan 2013 Link to this post

    Thanks.
    I have this asp defining the type of pager as PagerStyle Mode="NextPrevNumericAndAdvanced"
    I have put this in the code behind

     

    protected void gridAgreementList_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;

     

    }

    }



    And while the lvl.visible seems to work fine, the combo.visible line of code throws an exception "Object reference not set to an instance of an object."

    That seems to mean it was not finding the control.

    Any ideas?
  8. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 17 Jan 2013 Link to this post

    Further info for my previous post

    here is the version of radgrid

    <%

    @ Register Assembly="Telerik.Web.UI, Version=2011.1.413.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"

     

     

    Namespace="Telerik.Web.UI" TagPrefix="rad" %>

     



    And I have confirmed that the statement

        RadComboBox

     

    combo = (RadComboBox)pager.FindControl("PageSizeComboBox");
    is indeed returning null.  So there is no control with the name PageSizeComboBox.

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

    Posted 17 Jan 2013 Link to this post

    Hi,

    The PageSizeComboBox will be rendered only when the mode is NextPrevAndNumeric. Since the control is not rendered in NextPrevNumericAndAdvanced mode, the combobox will be null. Hope this helps.

    Thanks,
    Shinu
  10. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 18 Jan 2013 Link to this post

    Why are you saying my mode is not set right when I said in my post specifically:
        "I have this asp defining the type of pager as PagerStyle Mode="NextPrevNumericAndAdvanced""

    Am I misreading something or are you?

    Boy this process of 1 answer per day is frustrating especially when I post all the info I think you need and get an answer that doesn't take into account the info i provided. Sorry for sounding miffed but I am.  I don't mind if folks get things wrong (obviously I am doing something wrong myself) when we are chatting, but when turnaround time with this process is 1 day, you have to be careful to take the time to read all the post and understand it.

    Is there a way to get faster (immediate) help as a licensed user of the product?

    If it helps, here is the asp code:

    <

     

    rad:RadGrid ID="gridAgreementList" runat="server" Width="99%"

     

     

    AutoGenerateColumns="False" EnableLinqExpressions="false"

     

     

    Skin="Windows7" PageSize="10" AllowSorting="True" GridLines="Horizontal" CellPadding="0"

     

     

    SortingSettings-EnableSkinSortStyles="false"

     

     

    SortingSettings-SortedAscToolTip="<%$ Resources:UIText, SortedAscToolTip %>"

     

     

    SortingSettings-SortedDescToolTip="<%$ Resources:UIText, SortedDescToolTip %>"

     

     

    SortingSettings-SortToolTip="<%$ Resources:UIText, SortToolTip %>"

     

     

    OnPageIndexChanged="gridAgreementList_PageIndexChanged" OnPageSizeChanged="gridAgreementList_PageSizeChanged"

     

     

    OnSortCommand="gridAgreementList_SortCommand"

     

     

    onitemdatabound="gridAgreementList_ItemDataBound">

     

     

    <PagerStyle Mode="NextPrevNumericAndAdvanced" CssClass="quotePager" Position="TopAndBottom" HorizontalAlign="Center" />

     

  11. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 23 Jan 2013 Link to this post

    Hello,

    As Shinu said PageSizeComboBox will be rendered only when the mode is NextPrevAndNumeric. Note that when PagerStyle.Mode is NextPrevNumericAndAdvanced as it is in your case in the grid pager there is no ComboBox control. Therefore when you try to find it you receive - Object reference not set to an instance of an object error.

    Greetings,
    Pavlina
    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.
  12. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 23 Jan 2013 Link to this post

    According to http://www.telerik.com/help/aspnet-ajax/grid-pageritem.html, when the mode is NextPrevNumericAndAdvanced, there is a Page Size box.  I want to hide that control and its label. How can I do that?
  13. Bill
    Bill avatar
    23 posts
    Member since:
    May 2007

    Posted 23 Jan 2013 Link to this post

    I have solved this.  Feel free to let me know if there is something not done properly.

     protected void gridAgreementList_ItemCreated(object sender, GridItemEventArgs e)
       {
          if (e.Item is GridPagerItem)
     
             // Hide controls related to the page size of the grid (i.e. # of rows to display)
             {
                Label changePageSizeLabel = (Label)e.Item.FindControl("ChangePageSizeLabel");
                changePageSizeLabel.Visible = false;

                Button changePageSizeLinkButton = (Button)e.Item.FindControl("ChangePageSizeLinkButton");
                changePageSizeLinkButton.Visible = false;

                RadNumericTextBox changePageSizeText = (RadNumericTextBox)e.Item.FindControl("ChangePageSizeTextBox");
                changePageSizeText.Visible = false;
             }
          }

  14. he
    he avatar
    2 posts
    Member since:
    Oct 2012

    Posted 04 Jul 2013 Link to this post

    <PagerStyle ... PageSizeControlType="None"... />
  15. FIT Bilgi islem Sistemleri Servis
    FIT Bilgi islem Sistemleri Servis avatar
    1 posts
    Member since:
    Apr 2013

    Posted 07 Aug 2013 Link to this post

    he, your solution

    <PagerStyle PageSizeControlType="None" />

    worked perfectly for me, thanks.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017