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

Telerik RadGrid - Singular/Plural

3 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
srinivasskc
Top achievements
Rank 1
srinivasskc asked on 28 Aug 2012, 04:54 PM
In Telerik,RadGrid - When we have only 2 records in a single page - why does it show as "2items in 1 pages" -- why cant be "2items in 1 page" ? 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Aug 2012, 05:16 AM
Hi,

You can set the PagerTextFormat depending on the PagerStyle Mode. Check the following help documentation which explains more about this.
Using PagerTextFormat.

Thanks,
Shinu.
0
srinivasskc
Top achievements
Rank 1
answered on 31 Aug 2012, 04:19 PM
Hi,

I am now getting in the gridview as 2items in 1 pages... I wanted to look as 2items in 1 page(s)..

How do i make?
0
Radoslav
Telerik team
answered on 03 Sep 2012, 07:30 AM
Hi Srinivas,

To achieve the desired functionality you could try using the following code snippet:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        GridPagerItem item = e.Item as GridPagerItem;
        if (item != null)
        {
            if (DataItemsCount <= RadGrid1.PageSize)
            {
                var text = ((item.Controls[0].Controls[0] as Table).Rows[0].Cells[0].Controls[4].Controls[0] as LiteralControl).Text;
                text = text.Replace("pages", "page");
                ((item.Controls[0].Controls[0] as Table).Rows[0].Cells[0].Controls[4].Controls[0] as LiteralControl).Text = text;
            }
        }
    }
Where the DataItemsCount is the count of the data source items to which the RadGrid is bound. Additionally I am sending you a simple example which demonstrates that.

I hope this helps.

Kind regards,
Radoslav
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.
Tags
Grid
Asked by
srinivasskc
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
srinivasskc
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or