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

How do I translate the Pager in a grid?

3 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Clark
Top achievements
Rank 2
Paul Clark asked on 28 Oct 2009, 05:12 PM
Hello

I have been treking through the forums and documentation to find out how to do this and I am throughly confused!
My Website has a flag that can be changed and when this happens we re-load all the text on the site files.
I can transate the column headers by doing something like this:

 

RadGrid1.Columns[3].HeaderText = Translations.Common.ColumnName 

  

 

 

 

but cannot work out how to do the pager.

I am using the default pager, (ie I haven't set it to anything specific) currently the pager shows
 |< < 12 > >| page size <a dropdown>      .......  11 items in 2 pages

Can I just pass the culture to the grid and it will do it automatically? or is that just wishful thinking and I have to do it my self? Ideally I don't want a custom pager, but I don't get how to get access to the bits to be able to translate the default one?

Thanks in advance

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Oct 2009, 04:41 AM
Hello Paul,

You can try accessing the controls from the code behind and then change the texts respectively:
c#:
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pager = (GridPagerItem)e.Item; 
            Label lbl = (Label)pager.FindControl("ChangePageSizeLabel"); 
            lbl.Text = "CustomText1";             
 
            RadGrid1.PagerStyle.PagerTextFormat = "{4} CustomText {2} CustomText {3} CustomText {5}"
        } 
    } 
 

Thanks
Princy.
0
Paul Clark
Top achievements
Rank 2
answered on 29 Oct 2009, 09:09 AM
Thanks Princy!

Do you know is this documented anywhere? So I know what the {x} 's are for incase I want to rearrange it?

0
Princy
Top achievements
Rank 2
answered on 29 Oct 2009, 11:19 AM
Hi Paul,

Here's the help document link to format the text that appears in the pager:
Using PagerTextFormat

Thanks
Princy.
Tags
Grid
Asked by
Paul Clark
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Paul Clark
Top achievements
Rank 2
Share this question
or