Is there a way I can display the item count in the Status Bar or the grid when paging is disabled? When paging is enabled, theres a message such as " 91 items in 7 pages" (like here: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/groupby/defaultcs.aspx), but is there a way i can have it say something like "Displaying 91 items."? I know I can make use of column aggregation, but I'm wondering specifically about the Status Bar.
7 Answers, 1 is accepted
One suggestion is you can get the total items count in item event and then set the count in prerender event. Here is the sample code that I tried which worked as expected.
C#:
int
i;
protected
void
RadGrid1_ItemEvent(
object
sender, GridItemEventArgs e)
{
if
(e.EventInfo
is
GridInitializePagerItem)
{
i = (e.EventInfo
as
GridInitializePagerItem).PagingManager.DataSourceCount;
}
}
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
RadGrid1.StatusBarSettings.ReadyText = i.ToString() ;
RadGrid1.MasterTableView.Rebind();
}
Thanks,
Princy
Unfortunately the required functionality could not be achieved per your requirements. After Q1 2009 the StatusBar item was modified and it could only appear if you have paging enabled for the RadGrid control.
Excuse us for any inconvenience this may lead. We will update our documentation to add this statement as soon as possible.
Maria Ilieva
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
As I previously mentioned the required functionality could only be achieved in case the paging is enabled for the RadGrid control. So I would suggest you to enable the paging feature for the RadGrid control in order to show the item count status bar.
Greetings,
Maria Ilieva
the Telerik team
I got the status bar to show without paging information by doing the following:
.Pageable(page => page
.PreviousNext(false)
.Numeric(false)
Now I get the status bar with how many items I have without showing the paging information which I don't need because my grid is scrollable.
I forgot one thing, in the .DataSource you need to set your PageSize to something you'll never reach since it seems to default to 10 items if you don't
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(10000))