zoukankan      html  css  js  c++  java
  • Removing Page Size control From RadGrid

    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.

    Solution 1(C# Codes):

    You can either disable the page size combobox so that the user cannot change the page size:

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

    {

          if (e.Item is GridPagerItem)

            {

                GridPagerItem pagerItem = (GridPagerItem)e.Item;

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

                combo.Visible= false;         

            }

    }

    Solution 2(CSS):

    or , Try adding following CSS in order to hide the pagesize dropdown in grid (Change Page Size and other Advanced function will be hidden).

    div.RadGrid .rgPager .rgAdvPart
    {
         display: none;
    }

    If I use a PagerStyle mode of  NextPrevAndNumeric everything works just fine.  I would like to be able to use the mode of

    NextPrevNumericAndAdvanced.  However the "Page xxxx of xxxx GO" could not be seen. Therefore, I changed the CSS as below:

    /*div.RadGrid .rgPager .rgAdvPart,
    {
         display: none;
    }*/

    #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_ChangePageSizeLabel,
    #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_ChangePageSizeTextBox_wrapper,
    #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_ChangePageSizeTextBox_text,
    #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_ChangePageSizeLinkButton
    {
         display: none;
    }

    or

    div.RadGrid .rgPager .rgAdvPart
    {
        display: none;
    }

    #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageLabel, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageTextBox_wrapper, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageTextBox_text, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageTextBox, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageTextBox_Value, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageTextBox_ClientState, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_PageOfLabel, #ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl03_ctl01_GoToPageLinkButton
    {
        display: inline;
    }

    REF:

    http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-remove-quot-page-size-quot-dropdown.aspx

  • 相关阅读:
    根据方法名执行方法的例子
    修改cmd的默认路径
    事件处理程序的处理顺序问题
    类型事件定义
    修改应用程序搜索程序集的私有路径
    What's New in Visual Studio 2010
    IE 8 中选项卡通过颜色分组
    再谈CLR:无法避免的装箱
    环境变量(Environment Variable)那点事
    默认情况下程序启动后到底是几个线程?
  • 原文地址:https://www.cnblogs.com/emanlee/p/1525792.html
Copyright © 2011-2022 走看看