We have an application that can potentially pull in a LOT of items into a grid control. So many that we've had to put a limit in of 300. However, the users want to see the TOTAL number of items as well as the "maximum allowed" number of items. So if we've got 1,000 records and a per-page count of 25, they'd like to see "300 of 1000 in 12 pages". Is there a way to do this? I've experimented with the VirtualItemCount property but that doesn't seem to quite do it.
Thanks in advance for any helpful replies, even if it's just "No, this can't be done in this control!"
Thanks in advance for any helpful replies, even if it's just "No, this can't be done in this control!"
5 Answers, 1 is accepted
0
Jerry
Top achievements
Rank 1
answered on 18 Nov 2013, 07:50 PM
I've also experimented with the PagerTextFormat attribute but don't find a {x} value to use to represent the arbitrary value (the 1,000 in the example above) to display. No brain storms out there?
0
Shinu
Top achievements
Rank 2
answered on 19 Nov 2013, 06:25 AM
Hi Jerry,
You can set the PagerTextFormat as shown below. Please note that the '{4}' parameters is mandatory when setting PagerTextFormat property.
For more information, please refer to this help article.
ASPX:
Thanks,
Shinu
You can set the PagerTextFormat as shown below. Please note that the '{4}' parameters is mandatory when setting PagerTextFormat property.
For more information, please refer to this help article.
ASPX:
<
PagerStyle
AlwaysVisible
=
"true"
PagerTextFormat
=
"{4}Showing items {3} of {5} in {1} pages"
/>
Thanks,
Shinu
0
Jerry
Top achievements
Rank 1
answered on 19 Nov 2013, 01:08 PM
Thanks, but that doesn't quite do it. If I have 1,000 items but can only load 300 of them into memory and show them 25 at a time, I need to see this:
Showing 300 of 1000 items in 12 pages
Using your code, I get this:
Showing items 25 of 300 in 12 pages
It's kind of like I need a {6} parameter where I can specify an arbitrary value; in this case the "1000".
Showing 300 of 1000 items in 12 pages
Using your code, I get this:
Showing items 25 of 300 in 12 pages
It's kind of like I need a {6} parameter where I can specify an arbitrary value; in this case the "1000".
0
Shinu
Top achievements
Rank 2
answered on 20 Nov 2013, 07:26 AM
Hi Jerry,
You can try setting it from code behind, get the total count of your records and display it as follows:
C#:
Thanks,
Shinu
You can try setting it from code behind, get the total count of your records and display it as follows:
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
GridPagerItem pager = (GridPagerItem)e.Item;
int
total = rowCount;
//You code to get the total count of rows
RadGrid1.MasterTableView.PagerStyle.PagerTextFormat = Server.HtmlDecode(
"{4}Showing items {5} of "
+total+
" in {1} pages"
);
}
}
Thanks,
Shinu
0
Jerry
Top achievements
Rank 1
answered on 20 Nov 2013, 01:24 PM
Shinu;
With just a touch of formatting to get the text exactly like the customers wanted, this approach worked like a charm! Thank you! You've saved the day for me!
Jerry
With just a touch of formatting to get the text exactly like the customers wanted, this approach worked like a charm! Thank you! You've saved the day for me!
Jerry