How to add PagerSize in RadGrid

3 posts, 1 answers
  1. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 28 Aug 2011 Link to this post

    Hi Telerik,

    I'm using RadGrid Q2 2011, now I want to add more PagerSize in RadGrid,
    Default is {10, 20, 50}, I want add more like {10, 20, 50, 100, 150, ...}
    Please show me the way to do this.
    Thanks
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Aug 2011 Link to this post

    Hello,

    Try the following code snippet in ItemCreated event to change the default limits for number of items in a page.
    C#:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
           if (e.Item is GridPagerItem)          
            {
                GridPagerItem pagerItem = (GridPagerItem)e.Item;
                RadComboBox PageSizeCombo = (RadComboBox)pagerItem.FindControl("PageSizeComboBox");                
                RadComboBoxItem item = new RadComboBoxItem();
                item = new RadComboBoxItem("150");
                item.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
                PageSizeCombo.Items.Add(item);
            }
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 29 Aug 2011 Link to this post

    Hi Shinu,

    Thanks for your help :D
Back to Top