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

RadConfirm/RadAlert buttons caption

7 Answers 237 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ivan Queiroz
Top achievements
Rank 1
Ivan Queiroz asked on 21 Jul 2011, 06:21 PM
I know that I can change the captions for the RadConfirm buttons by changing the localization:

Telerik.Web.UI.RadWindowUtils.Localization =  
    "Close" : "Close"
    "Minimize" : "Minimize"
    "Maximize" : "Maximize"
    "Reload" : "Reload"
    "PinOn" : "Pin on"
    "PinOff" : "Pin off"
    "Restore" : "Restore"
    "OK" : "OK"
    "Cancel" : "Cancel"
    "Yes" : "Yes"
    "No" : "No"   
}; 

The question then is: if in the same page a have both a RadConfim and a RadAlert,, is it possible to have different captions for the OK buttons? For example, the "OK" for RadConfirm would be "Click Here," and the "OK" for RadAlert would be "Ouch!".

Is it possible to manipulate the localization in the code behind so that the button captions are set dynamically?

Thanks,

Ivan

7 Answers, 1 is accepted

Sort by
0
Ivan Queiroz
Top achievements
Rank 1
answered on 22 Jul 2011, 12:28 PM
I tried to change the dialog template as described in the article http://www.telerik.com/help/aspnet-ajax/window-dialogs-changing-dialog-templates.html, but now the button captions are blank. Any ideas? I'm using V 2010.3.1317.40.

Thanks.
0
Svetlina Anati
Telerik team
answered on 22 Jul 2011, 03:30 PM
Hi Ivan Queiroz,

 

You can achieve what you want with some javascript - for your convenience I prepared it for you:

//radalert
var oAlert = radalert("test");
var alertOKbtn = $telerik.getElementByClassName(oAlert.get_contentElement(), "rwInnerSpan", "span");
alertOKbtn.innerHTML = "OKTextAlert";
 
//radconfirm
var oConfirm = radconfirm("test");
var confirmOKbtn = $telerik.getElementByClassName(oConfirm.get_contentElement(), "rwInnerSpan", "span");
confirmOKbtn.innerHTML = "OKTextConfirm";


Please, tets the provided code and let me know how it goes.

Regards,
Svetlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ivan Queiroz
Top achievements
Rank 1
answered on 22 Jul 2011, 06:48 PM
Thanks Svetlina,

That works well. How about changing the caption of the "cancel" button?

Thanks again,

Ivan
0
Marin Bratanov
Telerik team
answered on 25 Jul 2011, 01:46 PM
Hello Ivan,

Please examine the following article for more information on localizing the RadWindow and the predefined dialogs: http://www.telerik.com/help/aspnet-ajax/radwindow-localization.html.


All the best,
Marin
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
G
Top achievements
Rank 1
answered on 23 Jul 2013, 10:36 AM
Hi,

I have a requirement regarding the radconfirm/radalert button caption.

  Telerik.Web.UI.RadWindowUtils.Localization =
   {
       "OK": "Yes",
       "Cancel": "No",
   };

By using the above I can change the radconfirm ok/ cancel button to yes/no.
Now, on the same aspx page I am using radalert and the radalert button 'ok' is change to 'yes', this is the issue.
I want to keep radalert button as OK but radconfirm button should be yes/no, can this be possible.

Thanks,

GS

0
Princy
Top achievements
Rank 2
answered on 23 Jul 2013, 12:00 PM
Hi G,

When you apply localization to the RadWindowManager, the change is reflected in all the Dialogs such as RadConfirm, RadAlert which is considered as its default behavior. One suggestion is you can add separate RadWindowManager for each dialog as shown in the following sample code.

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Localization OK="Yes" Cancel="No" />
</telerik:RadWindowManager>
<telerik:RadWindowManager ID="RadWindowManager2" runat="server">
</telerik:RadWindowManager>
<telerik:RadButton ID="RadButton1" runat="server" Text="Open RadConfirm" AutoPostBack="false"
    OnClientClicked="OnClientClicked1">
</telerik:RadButton>
<br />
<telerik:RadButton ID="RadButton2" runat="server" Text="Open RadAlert" AutoPostBack="false"
    OnClientClicked="OnClientClicked2">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    function OnClientClicked1() {
        var radwindowmanager1 = $find('<%=RadWindowManager1.ClientID %>');
        radwindowmanager1.radconfirm("Confirm Delete");
    }
    function OnClientClicked2() {
        var radwindowmanager2 = $find('<%=RadWindowManager2.ClientID %>');
        radwindowmanager2.radalert("Item Deleted");
    }  
</script>

Thanks,
Princy.
0
rdmptn
Top achievements
Rank 1
answered on 23 Jul 2013, 01:20 PM
Of course they will be affected, the script uses global objects.
If you want them different just change the default templates and add the text you want: http://www.telerik.com/help/aspnet-ajax/window-dialogs-changing-dialog-templates.html. You don't even need a second RadWindowManager with this.
Tags
Window
Asked by
Ivan Queiroz
Top achievements
Rank 1
Answers by
Ivan Queiroz
Top achievements
Rank 1
Svetlina Anati
Telerik team
Marin Bratanov
Telerik team
G
Top achievements
Rank 1
Princy
Top achievements
Rank 2
rdmptn
Top achievements
Rank 1
Share this question
or