Localizing the "NextPrevNumericAndAdvanced" pager

18 posts, 0 answers
  1. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 15 Jan 2009 Link to this post

    Hi,

    Using 2008 Q3 SP2 (2008.3.1314.35), I build a RadGrid using :
       <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 

    I've programmed a small helper class that basically localizes the RadGrid from a global resource file, but I've got two problems :

    1) The pager is always reverted back to "NextPrev" when setting the localized text via "RadGrid.MasterTableView.PagerStyle", for example :
    RadGrid.MasterTableView.PagerStyle.NextPagesToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_NextPagesToolTip"); 

    but is remains to "NextPrevNumericAndAdvanced" when setting via "RadGrid.PagerStyle", for example :
    RadGrid.PagerStyle.NextPagesToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_NextPagesToolTip"); 

    Why is that ? Which one is the right one to use ?

    2) The "Advanced" part cannot be localize using the same manner. I've found this old thread that mentions that you have to use the "RadGrid1_ItemCreated" event handler and set GoToPageLabel, GoToPageLinkButton, ChangePageSizeLabel and ChangePageSizeLinkButton. Is there a better way now ? It seems strange that everything else but that is so easily localizable...

    Thanks for your help,

    dstj.
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 19 Jan 2009 Link to this post

    Hi Dominic,

    Straight onto your questions:

    1)  You need to use the second way of setting the localized text because the MasterTableView's PagerStyle is overridden by the RadGrid.PagerStyle.

    2) If you want to work with controls from "Advanced" part of the pager, you need to get reference to them via GridPagerItemInstance.FindControl() method. For now there is no other way how to localize them directly.

    Kind regards,
    Georgi Krustev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 19 Jan 2009 Link to this post

    Thanks for your answers. I am not familiar with the GridPagerItemInstance.FindControl() method. How would I use it?

    Right now, I'm doing the following to localize the whole RadGrid. Is anything wrong with this way of doing things ?

       public static class RadGridLocalizer 
       { 
          public static void Localize(Telerik.Web.UI.RadGrid RadGrid) 
          { 
             RadGrid.GroupingSettings.CollapseTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_CollapseTooltip"); 
             RadGrid.GroupingSettings.ExpandTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_ExpandTooltip"); 
             RadGrid.GroupingSettings.GroupByFieldsSeparator = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_GroupByFieldsSeparator"); 
             RadGrid.GroupingSettings.GroupContinuedFormatString = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_GroupContinuedFormatString"); 
             RadGrid.GroupingSettings.GroupContinuesFormatString = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_GroupContinuesFormatString"); 
             RadGrid.GroupingSettings.GroupSplitDisplayFormat = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_GroupSplitDisplayFormat"); 
             RadGrid.GroupingSettings.GroupSplitFormat = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_GroupSplitFormat"); 
             RadGrid.GroupingSettings.UnGroupTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupingSettings_UnGroupTooltip"); 
     
             RadGrid.GroupPanel.Text = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupPanel_Text"); 
             RadGrid.GroupPanel.ToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""GroupPanel_ToolTip"); 
     
             RadGrid.HeaderContextMenu.ToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""HeaderContextMenu_ToolTip"); 
     
             RadGrid.HierarchySettings.CollapseTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""HierarchySettings_CollapseTooltip"); 
             RadGrid.HierarchySettings.ExpandTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""HierarchySettings_ExpandTooltip"); 
             RadGrid.HierarchySettings.SelfCollapseTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""HierarchySettings_SelfCollapseTooltip"); 
             RadGrid.HierarchySettings.SelfExpandTooltip = (string)HttpContext.GetGlobalResourceObject("RadGrid""HierarchySettings_SelfExpandTooltip"); 
     
             RadGrid.MasterTableView.Caption = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_Caption"); 
     
             RadGrid.MasterTableView.CommandItemSettings.AddNewRecordImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_CommandItemSettings_AddNewRecordImageUrl"); 
             RadGrid.MasterTableView.CommandItemSettings.AddNewRecordText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_CommandItemSettings_AddNewRecordText"); 
             RadGrid.MasterTableView.CommandItemSettings.RefreshImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_CommandItemSettings_RefreshImageUrl"); 
     
             RadGrid.MasterTableView.CommandItemSettings.RefreshText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_CommandItemSettings_RefreshText"); 
     
             RadGrid.MasterTableView.EditFormSettings.CaptionFormatString = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_EditFormSettings_CaptionFormatString"); 
     
             RadGrid.MasterTableView.ExpandCollapseColumn.CollapseImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_CollapseImageUrl"); 
             RadGrid.MasterTableView.ExpandCollapseColumn.EditFormHeaderTextFormat = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_EditFormHeaderTextFormat"); 
             RadGrid.MasterTableView.ExpandCollapseColumn.ExpandImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_ExpandImageUrl"); 
             RadGrid.MasterTableView.ExpandCollapseColumn.FooterText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_FooterText"); 
             RadGrid.MasterTableView.ExpandCollapseColumn.HeaderImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_HeaderImageUrl"); 
             RadGrid.MasterTableView.ExpandCollapseColumn.HeaderText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_ExpandCollapseColumn_HeaderText"); 
     
             RadGrid.MasterTableView.FilterExpression = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_FilterExpression"); 
             RadGrid.MasterTableView.NoDetailRecordsText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_NoDetailRecordsText"); 
             RadGrid.MasterTableView.NoMasterRecordsText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_NoMasterRecordsText"); 
     
             RadGrid.PagerStyle.NextPagesToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_NextPagesToolTip"); 
             RadGrid.PagerStyle.NextPageText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_NextPageText"); 
             RadGrid.PagerStyle.NextPageToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_NextPageToolTip"); 
             RadGrid.PagerStyle.PagerTextFormat = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_PagerTextFormat"); 
             RadGrid.PagerStyle.PrevPagesToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_PrevPagesToolTip"); 
             RadGrid.PagerStyle.PrevPageText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_PrevPageText"); 
             RadGrid.PagerStyle.PrevPageToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_PagerStyle_PrevPageToolTip"); 
     
             RadGrid.MasterTableView.RowIndicatorColumn.EditFormHeaderTextFormat = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_RowIndicatorColumn_EditFormHeaderTextFormat"); 
             RadGrid.MasterTableView.RowIndicatorColumn.FooterText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_RowIndicatorColumn_FooterText"); 
             RadGrid.MasterTableView.RowIndicatorColumn.HeaderImageUrl = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_RowIndicatorColumn_HeaderImageUrl"); 
             RadGrid.MasterTableView.RowIndicatorColumn.HeaderText = (string)HttpContext.GetGlobalResourceObject("RadGrid""MasterTableView_RowIndicatorColumn_HeaderText"); 
     
             RadGrid.SortingSettings.SortedAscToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""SortingSettings_SortedAscToolTip"); 
             RadGrid.SortingSettings.SortedDescToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""SortingSettings_SortedDescToolTip"); 
             RadGrid.SortingSettings.SortToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""SortingSettings_SortToolTip"); 
             RadGrid.StatusBarSettings.LoadingText = (string)HttpContext.GetGlobalResourceObject("RadGrid""StatusBarSettings_LoadingText"); 
             RadGrid.StatusBarSettings.ReadyText = (string)HttpContext.GetGlobalResourceObject("RadGrid""StatusBarSettings_ReadyText"); 
             RadGrid.ToolTip = (string)HttpContext.GetGlobalResourceObject("RadGrid""ToolTip"); 
     
             RadGrid.ClientSettings.ClientMessages.DropHereToReorder = (string)HttpContext.GetGlobalResourceObject("RadGrid""ClientSettings_ClientMessages_DropHereToReorder"); 
             RadGrid.ClientSettings.ClientMessages.DragToGroupOrReorder = (string)HttpContext.GetGlobalResourceObject("RadGrid""ClientSettings_ClientMessages_DragToGroupOrReorder"); 
             RadGrid.ClientSettings.ClientMessages.DragToResize = (string)HttpContext.GetGlobalResourceObject("RadGrid""ClientSettings_ClientMessages_DragToResize"); 
             RadGrid.ClientSettings.ClientMessages.PagerTooltipFormatString = (string)HttpContext.GetGlobalResourceObject("RadGrid""ClientSettings_ClientMessages_PagerTooltipFormatString"); 
     
             RadGrid.ItemCreated += new Telerik.Web.UI.GridItemEventHandler(RadGrid_ItemCreated); 
          } 
     
          static void RadGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
          { 
             if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Pager) { 
                Telerik.Web.UI.GridPagerItem item = (Telerik.Web.UI.GridPagerItem)e.Item; 
     
                Label GoToPageLabel = item.FindControl("GoToPageLabel"as Label; 
                LinkButton GoToPageLinkButton = item.FindControl("GoToPageLinkButton"as LinkButton; 
                Label ChangePageSizeLabel = item.FindControl("ChangePageSizeLabel"as Label; 
                LinkButton ChangePageSizeLinkButton = item.FindControl("ChangePageSizeLinkButton"as LinkButton; 
     
                if (GoToPageLabel != null) { 
                   GoToPageLabel.Text = (string)HttpContext.GetGlobalResourceObject("RadGrid""GridPagerItem_GoToPageLabel"); 
                } 
                if (GoToPageLinkButton != null) { 
                   GoToPageLinkButton.Text = (string)HttpContext.GetGlobalResourceObject("RadGrid""GridPagerItem_GoToPageLinkButton"); 
                } 
                if (ChangePageSizeLabel != null) { 
                   ChangePageSizeLabel.Text = (string)HttpContext.GetGlobalResourceObject("RadGrid""GridPagerItem_ChangePageSizeLabel"); 
                } 
                if (ChangePageSizeLinkButton != null) { 
                   ChangePageSizeLinkButton.Text = (string)HttpContext.GetGlobalResourceObject("RadGrid""GridPagerItem_ChangePageSizeLinkButton"); 
                } 
             } 
          } 

    RadGridLocalizer.Localize(....) would be called from the page's Page_Load or Page_Init event...

    Thanks,

    dstj.
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 19 Jan 2009 Link to this post

    Hi Dominic,

    Actually you are pretty much familiar with FindControl() method, because I noticed that you used it in your code. GridPageItem item is derived from System.Web.UI.Control, which declares FindControl() method.

    In case you want to achieve better maintainability of the pager, I will suggest you create a Pager Template. In this way you can localize it with less work, and you can apply it to all grids.

    Here is a link for Pager Template live demo.

    Kind regards,
    Georgi Krustev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. nenita
    nenita avatar
    18 posts
    Member since:
    Dec 2008

    Posted 15 Apr 2009 Link to this post

    I'm sorry by my ignorance but It's not possible do something like this localization asp-net-ajax document in this case too?

    Thanks in advance.


  7. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 16 Apr 2009 Link to this post

    Hello Nenita,

    The RadGrid does not support this type of localization. Nevertheless you can easily change the localization of the RadGrid with resource files. For further information please review this online help article which is devoted on this matter.

    Best regards,
    Georgi Krustev
    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.
  8. Pedro
    Pedro avatar
    2 posts
    Member since:
    Mar 2009

    Posted 16 Apr 2009 Link to this post

    Hi, i need to localize radgrid and its child controls.

    I want to do something like i have done in rad editor. http://www.telerik.com/help/aspnet-ajax/usingglobalresourcefiles.html

    how can i do it?

    Thanks for your help
  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2009 Link to this post

    Hello Pedro,

    You can refer to the following link to understand how to localize grid using a global resource file:
    Localization through resource files

    Thanks
    Princy.
  10. Pedro
    Pedro avatar
    2 posts
    Member since:
    Mar 2009

    Posted 17 Apr 2009 Link to this post

    this is the only way?

    I want to do it in a automated mode...

    My idea is just create a resx file whit the name of the control plus ".language". Someting like "RadGridPage.pt-PT.resx"

    and "RadGridFilter.pt-PT.resx".... The control would find language and choose the apropriate resx...

    Just like its done in radeditor? this is not possible?

    thks
  11. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 22 Apr 2009 Link to this post

    Hello Pedro,

    I'm afraid RadGrid does not support the requested functionality in the current version of RadControls for ASP.NET AJAX.

    I passed this request to our developers for future consideration.

    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.
  12. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 04 Jul 2009 Link to this post

    Just a follow up:

    The q2 2009 Grid has a great default pager (maybe it has been there before - but I first noticed it in 2009.Q2.
    The reason - normally I localize the pager via code - and just by testing some new Q2 features I used the default one...

    Anyhow - ONE (only ONE!!!) point is missing in localization!
    I can set the Tooltips - I can set the PagerTextFormat (in German for an example to

    {4} Elemente <b>{2}</b> bis <b>{3}</b> von <b>{5}</>


    The "4" doesn't display anything - but it is needed.
    Now I have a real nice pager (without any code behind).

    Except the "Page size:" - this can't be changed declarative (or have I overseen something?).

    By the way - Rad Grind (I guess) is one of the most used telerik aspx controls - like it is for the editor.
    I just guess - but those two kids are the most powerful controls in the suite.

    Maybe you think about resource usage for the grid - as you did (great job) for the editor (and its tools).

    Regards

    Manfred
  13. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 08 Jul 2009 Link to this post

    Hello Manni,

    The next release of RadControls for ASP.NET AJAX will introduce the possibility to localize the PageSize text via the PagerStyle settings.

    Regarding the resources - your feedback on our new code-library sample will be appreciated!
    Localization files for RadGrid, RadCalendar and RadInput

    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.
  14. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 14 Jul 2009 Link to this post

    Hi,

    maybe I've overseen something - but there is one element left which I can't localize.
    The "Expand / Collapse" column tooltip (or text if link button).

    And from my point of view this is more than localization.
    For an example it could be nice to show something like "Show order details" or such a text.

    Regards

    Manfred
  15. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 14 Jul 2009 Link to this post

    Hello ManniAT,

    How to localize the expand/collapse tooltips you can see from this topic in the online documentation:
    http://www.telerik.com/help/aspnet-ajax/grdlocalizingtootips.html

    You can alter the default text to "Show order details" or some other string if you prefer.

    Best,
    Sebastian
    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.
  16. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 14 Jul 2009 Link to this post

    Hi Sebastian,

    thanks for the prompt answer - it was as I wrote "..maybe I've overseen..." :)

    Regards

    Manfred
  17. Rini Boo
    Rini Boo avatar
    14 posts
    Member since:
    Sep 2009

    Posted 15 Sep 2009 Link to this post

    We have been using the localizing feature by using FindControl for a while, and recently we have upgraded to the latest RadGrid (ASP.NET_AJAX_2009_2_826),  now the text for the buttons no longer works.  Any idea why?

    GoToPageLabel   - works
    GoToPageLinkButton - NOT working
    ChangePageSizeLabel - works
    ChangePageSizeLinkButton - NOT working

    Thanks in advanced.

    R.B.
  18. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Sep 2009 Link to this post

    Hello Rini,

    I tried the following code at my end to customize the advanced pager buttons and it worked as expected. Check for differences with your code and let me know if this helps:
    c#:
     protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridPagerItem) 
            {             
                Button btn = (Button)e.Item.FindControl("GoToPageLinkButton"); 
                btn.Text = "Custom GoToPage Text"
                Button btn1 = (Button)e.Item.FindControl("ChangePageSizeLinkButton"); 
                btn1.Text = "Custom ChangePageSize Text";             
            } 
        } 

    Thanks
    Princy.
  19. Rini Boo
    Rini Boo avatar
    14 posts
    Member since:
    Sep 2009

    Posted 24 Sep 2009 Link to this post

    Thanks Princy.  It works now,  the problem was in the older version, we were told to cast the button as "LinkButton" and it has been working fine. I guess in newer version, it has been changed to "Button".
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017