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

Localizing ConformDialog buttons

9 Answers 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Somberg
Top achievements
Rank 2
Paul Somberg asked on 07 Sep 2012, 07:48 AM
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>

9 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 12 Sep 2012, 08:46 AM
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.
0
Arnaud
Top achievements
Rank 1
answered on 18 Sep 2013, 11:17 AM
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 ?

0
Antonio Stoilkov
Telerik team
answered on 23 Sep 2013, 05:57 AM
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.
0
Arnaud
Top achievements
Rank 1
answered on 23 Sep 2013, 02:23 PM
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
0
Antonio Stoilkov
Telerik team
answered on 25 Sep 2013, 11:38 AM
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.
0
Arnaud
Top achievements
Rank 1
answered on 25 Sep 2013, 12:19 PM
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.





0
Antonio Stoilkov
Telerik team
answered on 30 Sep 2013, 06:36 AM
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.
0
Arnaud
Top achievements
Rank 1
answered on 30 Sep 2013, 07:47 AM
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 ?
0
Princy
Top achievements
Rank 2
answered on 30 Sep 2013, 08:29 AM
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.
Tags
Grid
Asked by
Paul Somberg
Top achievements
Rank 2
Answers by
Antonio Stoilkov
Telerik team
Arnaud
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or