Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > get the total count of my RadGrid

Not answered get the total count of my RadGrid

Feed from this thread
  • Pierre avatar

    Posted on Apr 11, 2012 (permalink)


    Hi,

    I am trying to get the total count of my RadGrid.

    When I use GridResult.MasterTableView.Items.Count I get only the count on the actual page.

    I've seen a post that disable the Paging, count the total, reactivate the paging and rebind. http://www.telerik.com/community/forums/aspnet-ajax/grid/total-record-count-after-filter.aspx

    Is there any property that could return the total count ?

    Thanks to everyone.

    Reply

  • Posted on Apr 12, 2012 (permalink)

    Hi Pierre,

    Please try the following approach:

    C#:
    protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
    {
        if (e.EventInfo is GridInitializePagerItem)
        {
            int rowCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount;
        }
    }

    Thanks,
    Shinu.

    Reply

  • Pierre avatar

    Posted on Apr 13, 2012 (permalink)


    Thanks a lot for your quick answer Shinu,

    But where do I put this event in my ASPX ?

    How this event is fired ?

    I've found this on internet but it's not working.

    <ClientSettings>
         <ClientEvents OnDataBound="RadGrid1_ItemEvent" />
    </ClientSettings>

    Could you lead me ?

    Reply

  • Posted on Apr 16, 2012 (permalink)

    Hi Pierre,

    You can select the ItemEvent from the Events properties of the control.(Same as you attaching the ItemDataBound event)

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" onitemevent="RadGrid1_ItemEvent"></telerik:RadGrid>

    C#:
    protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
    {
        if (e.EventInfo is GridInitializePagerItem)
        {
            int rowCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount;
        }
    }

    Thanks,
    Shinu.

    Reply

  • Pierre avatar

    Posted on Apr 16, 2012 (permalink)

    Thanks a lot Shinu, it's perfect.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > get the total count of my RadGrid
Related resources for "get the total count of my RadGrid"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]