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

  • 相关阅读:
    Java中static、final、static final的区别(转)
    Google的JSON风格指南
    Google代码风格指南
    Java中的final关键字(转)
    Java的不定参数(eg:Object...)(转)
    Java Enum枚举的用法(转)
    Java中包装类型和基本类型的使用场景(什么时候使用包装类型)(转)
    Java常用的集合类(转)
    使用Swagger生成Spring Boot REST客户端(支持Feign)(待实践)
    Java搜索引擎选择: Elasticsearch与Solr(转)
  • 原文地址:https://www.cnblogs.com/emanlee/p/1525792.html
Copyright © 2011-2022 走看看