RadConfirm/RadAlert buttons caption

8 posts, 0 answers
  1. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 21 Jul 2011 Link to this post

    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
  2. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 22 Jul 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 22 Jul 2011 Link to this post

    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!

  5. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 22 Jul 2011 Link to this post

    Thanks Svetlina,

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

    Thanks again,

    Ivan
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 25 Jul 2011 Link to this post

    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!

  7. G
    G avatar
    7 posts
    Member since:
    Jul 2013

    Posted 23 Jul 2013 Link to this post

    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

  8. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Jul 2013 Link to this post

    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.
  9. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 23 Jul 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017