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

Display item count in Status Bar

7 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dasha
Top achievements
Rank 1
Dasha asked on 14 Jul 2011, 03:24 PM
Dear Support,

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

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jul 2011, 06:33 AM
Hello Dasha,

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
0
Dasha
Top achievements
Rank 1
answered on 18 Jul 2011, 12:29 PM
Still can't get it to show up.  Could it be because I'm using Advance Databind?
0
Maria Ilieva
Telerik team
answered on 21 Jul 2011, 09:09 AM
Hello Dasha,

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!

0
RAM SHAN
Top achievements
Rank 1
answered on 29 Feb 2012, 10:26 PM
I am looking for a similar functionality to show the total item count in the grid with out any paging. is that possible with Q2 2011 version of controls for radgrid. If not, any suggestions on alternative approaches that this can be achieved.

0
Maria Ilieva
Telerik team
answered on 05 Mar 2012, 10:30 AM
Hello,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Daniel
Top achievements
Rank 1
answered on 12 Sep 2018, 03:39 PM

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.

0
Daniel
Top achievements
Rank 1
answered on 12 Sep 2018, 03:43 PM

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))

Tags
Grid
Asked by
Dasha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dasha
Top achievements
Rank 1
Maria Ilieva
Telerik team
RAM SHAN
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Share this question
or