This is a migrated thread and some comments may be shown as answers.

Total number of rows

2 Answers 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 06 Apr 2015, 08:52 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Ralitsa
Telerik team
answered on 08 Apr 2015, 11:25 AM
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.

 
0
Todd
Top achievements
Rank 1
answered on 08 Apr 2015, 01:00 PM
Thanks, Ralitsa for the very helpful code snippet and demo! That's exactly the behavior that I was after.
Tags
GridView
Asked by
Todd
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Todd
Top achievements
Rank 1
Share this question
or