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

Change "Page size" text

9 Answers 478 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marta
Top achievements
Rank 1
Marta asked on 25 May 2009, 09:52 AM
Hi,

I'm using radgrids in my project and would like to change the default texts of "Page size" and "x items in x pages" since my website is in portuguese. I can't seem to figure out where I can access these texts in order to personalize them. Can anyone help please?

Thank you,
Marta

9 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 May 2009, 10:27 AM
Hello Marta,

Try the code-snippet below:
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="ID"
    <PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4} Items={0}  Pages={1}" /> 
    <Columns> 

I also recommend you examine the following links:
Accessing the elements of advanced type pager
Localizing the grid messages

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Marta
Top achievements
Rank 1
answered on 25 May 2009, 10:42 AM
Hi,

I don't think you understood my problem. I need to change the text that says "Page size" so that I can write my own text in portuguese. I tried the code  you wrote but it had nothing to do with it.  Help...

Marta
0
Marta
Top achievements
Rank 1
answered on 25 May 2009, 10:50 AM
The code in the link http://www.telerik.com/help/aspnet-ajax/grdusingpagettextformat.html that you provided helped sort the paging problem. Now just trying to change the "page size" text near the  dropdown list.

Thanks,
Marta
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 May 2009, 11:18 AM
Hello Marta,

You can try out the following code to change the text of PageSize label in the pager row:
c#:
protected void RadGrid1_ItemDataBound (object sender, GridItemEventArgs e) 
    {        
       if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pager = (GridPagerItem)e.Item;           
            Label lbl = (Label)pager.FindControl("ChangePageSizeLabel"); 
            lbl.Text = "YourCustomText"
        } 
     } 

Thanks
Princy.
0
Marta
Top achievements
Rank 1
answered on 25 May 2009, 11:24 AM
Thanks.
I have exactly that code, but I don't know why it isn't working... I don't get an error, but the text simply doesn't change... here is the code for the entire page. "Conteudos" is the name of my radgrid. The code for the griddataitem isn't working either...

Thank you.

using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.WebControls;
 
public partial class TodosConteudos : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
 
    protected void Conteudos_ItemDataBound(object sender, GridItemEventArgs e)
    {
 
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            HyperLink hyplnk = (HyperLink)item["VerFicha"].Controls[0];
            hyplnk.ImageUrl = "../imagens/bt_arvore_ficheiro.gif";
        }
 
        if (e.Item is GridPagerItem)
        {
            GridPagerItem pager = (GridPagerItem)e.Item;
            Label lbl = (Label)pager.FindControl("ChangePageSizeLabel");
            lbl.Text = "mjkmnio";
        }
 
    }  
}
0
Daniel
Telerik team
answered on 25 May 2009, 04:57 PM
Hello Marta,

Could you please post your RadGrid declaration here? Also let us know which version of RadControls is used in your scenario? Having this information at hand I will try to reproduce the problem locally.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
MAXX
Top achievements
Rank 1
answered on 10 Jun 2009, 12:31 PM
Hi Marta
dunno  if you've solved your problem yet, but I had a similar one and it works for me now:

sample.ascx.cs
        protected void RadGridSearchResult_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridPagerItem) 
            { 
                GridPagerItem pager = (GridPagerItem)e.Item; 
                Label l_pageSize = (Label)pager.FindControl("ChangePageSizeLabel"); 
                l_pageSize.Text = GetGlobalResourceObject("NATITitles""NATIPSPageSizeText").ToString(); 
            } 
        } 
 

just don't forget to set the OnItemDataBound event on the grid also
sample.ascx
<telerik:RadGrid ID="RadGridSearchResult" runat="server"  
    OnItemDataBound="RadGridSearchResult_ItemDataBound"  
    OnNeedDataSource="RadGridSearchResult_NeedDataSource"  
    AllowPaging="True" PageSize="5" GridLines="None" AutoGenerateColumns="False" > 
  <MasterTableView> 
       . 
       . 
       . 
  </MasterTableView> 
</telerik:RadGrid> 
 

0
Marta
Top achievements
Rank 1
answered on 16 Jun 2009, 04:27 PM
Thanks,

I solved my problem using

 

if (e.Item is GridPagerItem)

 

{

 

Label lblPageSize = (Label)e.Item.FindControl("ChangePageSizeLabel");

 

lblPageSize.Text =

"Itens por página:";

 

}



I had tried it before but another error on my page was not allowing the code to be executed.
0
Albert
Top achievements
Rank 1
answered on 16 Nov 2012, 11:55 AM
 <MasterTableView>
....
     <PagerStyle  PageSizeLabelText="Your_Page_Size_Text:" />
....
 </MasterTableView>
Tags
Grid
Asked by
Marta
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Marta
Top achievements
Rank 1
Princy
Top achievements
Rank 2
MAXX
Top achievements
Rank 1
Albert
Top achievements
Rank 1
Share this question
or