Total number of rows

3 posts, 1 answers
  1. Todd
    Todd avatar
    9 posts
    Member since:
    May 2011

    Posted 06 Apr 2015 Link to this post

    Hi,

    Is there any way to display the total number of rows contained in the data source within the paging panel? Please refer to the image attached for clues.

  2. Answer
    Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 08 Apr 2015 Link to this post

    Hi Todd,

    Thank you for contacting us.  

    You can set the EnablePaging property to true to show the PagingPanelElement in the RadGridView. You can refer to the following articles for more information about the public API for paging: GridView >> Paging 

    The PagingPanelElement can be customized and add any additional information that you need. Here is a sample code snippet demonstrating how to add a CommandBarLabel displaying the total number of items:
    CommandBarLabel label = new CommandBarLabel();
    label.Text = string.Format("Displaying {0} - {1} of {2} rows", currentPageStartIndex, currentPageEndIndex, this.radGridView1.RowCount);
     
    CommandBarStripElement strip = new CommandBarStripElement();
    strip.EnableDragging = false;
    strip.EnableFloating = false;
    strip.MinSize = Size.Empty;
    strip.DesiredLocation = new PointF(10000, 0);
    strip.Grip.Visibility = ElementVisibility.Collapsed;
    strip.OverflowButton.Visibility = ElementVisibility.Collapsed;
    strip.Items.Add(label);
    this.radGridView1.GridViewElement.PagingPanelElement.CommandBar.Rows.First().Strips.Add(strip);

    If you want to update the displayed information in the panel, you can subscribe to the PageChanged event which is fired when the current page is changed.

    I attached a sample demo too. 

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Ralitsa
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Todd
    Todd avatar
    9 posts
    Member since:
    May 2011

    Posted 08 Apr 2015 in reply to Ralitsa Link to this post

    Thanks, Ralitsa for the very helpful code snippet and demo! That's exactly the behavior that I was after.
Back to Top