Telerik RadGrid - Singular/Plural

4 posts, 0 answers
  1. srinivasskc
    srinivasskc avatar
    12 posts
    Member since:
    Sep 2012

    Posted 28 Aug 2012 Link to this post

    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" ? 
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 31 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. srinivasskc
    srinivasskc avatar
    12 posts
    Member since:
    Sep 2012

    Posted 31 Aug 2012 Link to this post

    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?
  5. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 03 Sep 2012 Link to this post

    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.
Back to Top