Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > How to Add "Show All" option in RadGrid Paging
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Answered How to Add "Show All" option in RadGrid Paging

Feed from this thread
  • Nikhil avatar

    Posted on Jun 24, 2011 (permalink)

    Hello,

    Can anybody please help me and show me How to Add "Show All" option in RadGrid Paging so that i can display all the records if needed. Right now it just has 10,20 and 50.

  • Answer Shinu MVP avatar

    Posted on Jun 24, 2011 (permalink)

    Hello Nikhil,

    In order to achieve this access the PageSizeComboBox in ItemCreated event. In ItemEvent get the total number of grid items and pass it as RadComboBox parameter. Hope this helps.

    C#:
    int TotalItemCount;
    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 item1 = new RadComboBoxItem();
                item1 = new RadComboBoxItem("Show All", TotalItemCount.ToString());
                item1.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
                PageSizeCombo.Items.Add(item1);
            }
    }
    protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
    {
            if (e.EventInfo is GridInitializePagerItem)
            {
                TotalItemCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount;
            }
    }

    Thanks,
    Shinu.

  • Nikhil avatar

    Posted on Jun 24, 2011 (permalink)

    Hello Shinu,
    Thanks a Ton for your reply.

    The code works but there is another problem now. When i select show all, it displays all the records, no doubt but it hides the pager Row, so i am not able to again change the number of records.

    Consider a situation, the grid loaded and i select "Show All", it shows all, then now i want to see just 10 records but there is no option for it.

    Kindly help! All your help is highly appreciated.

  • Answer Shinu MVP avatar

    Posted on Jun 24, 2011 (permalink)

    Hello Nikhil,

    Try setting the AlwaysVisible property of pager as true.

    aspx:
    <telerik:RadGrid ID="RadGrid1" AllowPaging="true" PageSize="5" runat="server" >
         <MasterTableView>                    
              <PagerStyle AlwaysVisible="true"/>
                        . . . .
         </MasterTableView>
    </telerik:RadGrid>

    Thanks,
    Shinu.

  • Nikhil avatar

    Posted on Jun 24, 2011 (permalink)

    Hello Shinu,
    You're Fantastic....

    Thanks a Ton. I had a another small issue related to Exporting RadGrid to Pdf. The problem is i wanted to add the date generated in the PDF. I could add a title in the PDF which is my Report's Name but i am not able to add a line which says : Date Generated: (date) .

    Second issue with the PDF is, My RadGrid has a footer which totals the entire content of a column(like EmpSalary) but when i export this grid into PDF, the Total in the footer is displayed on every page in the PDF. Can we not do something so that the total appears just once at the end of all pages.



    I would be very grateful if you can answer this for me.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > How to Add "Show All" option in RadGrid Paging