Localizing ConformDialog buttons

10 posts, 0 answers
  1. Paul Somberg
    Paul Somberg avatar
    9 posts
    Member since:
    Feb 2009

    Posted 07 Sep 2012 Link to this post

    Hello,

    I have a RadGrid that contains a confirm dialog. I can localize the message in the dialog using a local resource file, but the text on the buttons are always "OK" and "Cancel". Is it possible to translate these buttons using local or global (peferably) resource files?

    <telerik:GridButtonColumn HeaderText="Delete" meta:resourcekey="delete" CommandName="DeleteRole" ConfirmDialogType="RadWindow" ConfirmText="Delete this role?" ButtonType="ImageButton" ImageUrl="~/Images/Icons/delete.png"></telerik:GridButtonColumn>

    I already found a workaround on this forum. I know it's possible to do this using the following javascript, but I prefer to add the resource files and not add javascript code on all my pages (a lot) that use confirm dialogs.

    <script type="text/javascript">
    Telerik.Web.UI.RadWindowUtils.Localization =
    {
      "OK" : "Yes",
      "Cancel" : "No"
    };
    </script>

  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 12 Sep 2012 Link to this post

    Hi Paul,

    The described behavior could be achieved through code behind by accessing the column and setting its Text property to the desired resource. RadGrid MasterTableView RenderColumns holds all columns and you could loop through all of them and set a Text value on every GridButtonColumn.

    Greetings,
    Antonio Stoilkov
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Arnaud
    Arnaud avatar
    13 posts
    Member since:
    Sep 2013

    Posted 18 Sep 2013 Link to this post

    Hi Antonio

    GridButtonColumn does not have "text" property, neither "CancelText" property. We need to locolize 2 things : the "OK" button and the "Cancel" button.

    What is the exact code to do this ?

  5. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 23 Sep 2013 Link to this post

    Hello,

    In order to achieve your scenario you could directly localize the RadWindow OK and Cancel text as shown in the help article below.

    Regards,
    Antonio Stoilkov
    Telerik
    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 the blog feed now.
  6. Arnaud
    Arnaud avatar
    13 posts
    Member since:
    Sep 2013

    Posted 23 Sep 2013 Link to this post

    Hello Antonio

    This deals with RadwindowManager, and from the beginning we're talking about RadGrid in the thread.

    I tried to add a <Localization /> tag anyway inside the <telerik:RadGrid> and I face 2 problems :

    - I first get an error "cannot access internal property 'Localization' here

    - I could fin a "CancelText" property but nothing to translate the "OK" button. "OK" property exists for Radwindow but not for Radgrid columnbuttons.

    Arnaud
  7. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 25 Sep 2013 Link to this post

    Hello Arnaud,

    I am not sure I understand you correctly. I have understood that you are talking about the OK and Cancel text in the RadWindow that pops as a confirmation dialog as shown in the image below. Note that if you are talking for the ConfirmDialogType="Classic" dialog its OK and Cancel text could not be changed because it is determined by the browser. However, if you you want to change the OK and Cancel text for the ConfirmDialogType="RadWindow" you could do it through the RadWindow Localization which will change it in the RadGrid.

    Regards,
    Antonio Stoilkov
    Telerik
    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 the blog feed now.
  8. Arnaud
    Arnaud avatar
    13 posts
    Member since:
    Sep 2013

    Posted 25 Sep 2013 Link to this post

    Hello Antonio

    I'm using RadGrid with GridButtonColumns that , I guess, use an internal RadWindow to show the confirm dialog, but I don"t have any explicit RadWindow in my code.
    <telerik:RadGrid ID="...>
    <MasterTableView ...>
    <Columns>
    <telerik:GridButtonColumn ConfirmText="<%$ Resources: Traduction, IDS_ConfirmerSupprResPfl %>"
    ConfirmDialogType="RadWindow" ConfirmTitle="<%$ Resources: Traduction, IDS_Supprimer %>"
    ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="350px"  
    ItemStyle-Width="4%" UniqueName="DeleteresPFL" CancelText="Annuler">
    <HeaderStyle Width="2%" />
    </telerik:GridButtonColumn>

    I tried to add a <localization> inside the <telerik:GridButtonColumn> but it seems not to be recognized.
    I tried directly using properties of the <telerik:GridButtonColumn> tag : I could find CancelText="" but nothing to translate the OK button.





  9. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 30 Sep 2013 Link to this post

    Hello Arnaud,

    If you are using the RadWindow dialog you could place a RadWindowManager on the page in order to enable the functionality. Additionally, the RadWindowManager have a Localization property as shown below which will enable you to localize the OK and Cancel text.
    <telerik:RadWindowManager runat="server">
        <Localization OK="OK" Cancel="Cancel" />
    </telerik:RadWindowManager>

    Regards,
    Antonio Stoilkov
    Telerik
    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 the blog feed now.
  10. Arnaud
    Arnaud avatar
    13 posts
    Member since:
    Sep 2013

    Posted 30 Sep 2013 Link to this post

    Antonio

    I've tried several times to explain you we don't use radWindow but RadGridManager ! With gridbuttoncolumns with "delete" action, that, I guess, uses an internal radwindow that I don"t know how to tune.
    Do we have to insert a radwindow tag inside the radgridmanager tag ??

    Could you give us the exact code to use ?
  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Sep 2013 Link to this post

    Hi,

    Here is the sample code snippet I tried to change the Text of the Cancel and Ok Button.

    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Localization OK="Yes" Cancel="No" />
    </telerik:RadWindowManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
        AutoGenerateColumns="false">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn DataField="OrderName" HeaderText="OrderName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Color" HeaderText="Color">
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn DataField="ProductDate" HeaderText="ProductDate">
                </telerik:GridDateTimeColumn>
                <telerik:GridButtonColumn ConfirmText="<%$ Resources: Traduction, IDS_ConfirmerSupprResPfl %>"
                    ConfirmDialogType="RadWindow" ConfirmTitle="<%$ Resources: Traduction, IDS_Supprimer %>"
                    ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="350px"
                    ItemStyle-Width="4%" UniqueName="DeleteresPFL">
                    <HeaderStyle Width="2%" />
                </telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    Thanks,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017