Localization of the advanced type Pager

3 posts, 0 answers
  1. Francois MARTIN
    Francois MARTIN avatar
    44 posts
    Member since:
    Aug 2005

    Posted 19 Apr 2010 Link to this post

    Anyone who had to work on the Pager localization for a RadGrid must have been confronted with two things:

    1. The advanced pager cannot be localized as easily as the other styles of pagers for the RadGrid : there is no PagerStyle item property that you can set in your aspx file to localize the Labels and Buttons of the advanced pager (like "PagerTextFormat" or "PageSizeLabelText").
    2. You have to access the elements of the advanced pager as described in the following page: http://www.telerik.com/help/aspnet-ajax/grdaccessingdefaultpagerbuttons.html

    This is a litle bit anoying, just because Telerik has given us the habit of extreme ease and flexibility, with a lot of properties that are customizable immediateley. But hopefully, accessing the advanced pager items (and localizing them) is simple and well documented (see the URL above.)

    But something was missing. The "of" label as used in "Page x of y" is just not documented! After a litle investigation, it was rather easy to discover it, but the thing is that this Label doesn't contain only the word "of" but the page count as well ("of x" embedded in the same Label!)

    To fully localize the advanced pager for the RadGrid, and until Telerik gives us the missing properties that would allow us to localize it very easilly, here is the code that can be used (just a sample):
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
            //Is it a GridPagerItem  
            if (e.Item is GridPagerItem)  
                // Localization for the pager has to happen here.  
                Label lblPageSize = (Label)e.Item.FindControl("ChangePageSizeLabel");  
                lblPageSize.Text = "Page size";  
                Label gotoPage = (Label)e.Item.FindControl("GoToPageLabel");  
                gotoPage.Text = "Page";  
                Button gotoButton = (Button)e.Item.FindControl("GoToPageLinkButton");  
                gotoButton.Text = "Go";  
                Button changeButton = (Button)e.Item.FindControl("ChangePageSizeLinkButton");  
                changeButton.Text = "Change";  
                Label pageOfLabel = (Label)e.Item.FindControl("PageOfLabel");  
                pageOfLabel.Text = "of " + (((GridPagerItem)(e.Item))).Paging.PageCount;  

    I just hope that this post helps at least one person out there :)

  2. Martin
    Martin avatar
    810 posts

    Posted 22 Apr 2010 Link to this post

    Hello Francois,

    Thank you for your feedback. Indeed you are correct that the quoted help topic does to provide any information about localizing the "of" text inside the advanced slider pager. We have already corrected this article and the next upload of our documentation will reflect the change. However, note that if you would like to display the page count number you would need to append it to the label text (as you have discovered). This requirement will also be documented.

    I would like to inform you that our developers are currently working on improvement on the "Localization through resource files" capability of RadGrid. The Q2 2010 version of the control will allow the developer to localize the different labels and buttons inside the advanced grid pager.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft R3 2016 release webinar banner
  4. Francois MARTIN
    Francois MARTIN avatar
    44 posts
    Member since:
    Aug 2005

    Posted 22 Apr 2010 Link to this post

    Sounds great. It will definitely be usefull.
    Thank you.
Back to Top