RadWindow confirm dialog localization with resource files.

4 posts, 0 answers
  1. Eric Routhier
    Eric Routhier avatar
    8 posts
    Member since:
    Feb 2010

    Posted 23 Jul 2010 Link to this post

    Im currently using this example in one of my projects :
    Confirm dialog example

    When I want to use resources files to localize my application, i normally use a tag like this to set the text :
    Text="<%$ Code: ResourceFile.Some_TranslatedText_DependingOnCulture %>"

    Do you have a suggestion on how I can use the same technique to have to localized version of the prompt text and title text ? The sample below is obviously not working ...

    OnClientClick="return blockConfirm(" + <%$ Code: 
    .TranslatedPrompt %> + ", event, 330, 100, '', " + <%$ Code: 
     %> + ");"

    Thank you !
  2. Petio Petkov
    Petio Petkov avatar
    825 posts

    Posted 29 Jul 2010 Link to this post

    Hello Eric Routhier,

    You can store the resource values in custom attributes and use them in onclick, e.g.
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <script type="text/javascript">
            function ShowConfirm(text, title)
                radconfirm(text, confirmCallBackFn, 330, 100, null, title);
            function confirmCallBackFn(arg)
                radalert("radconfirm returned the following result: " + arg , null, null, "Result");
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
         <input type="button" value="ShowConfirm" 
            customText="<%$ Resources:ResourceFile, Text%>"
            customTitle="<%$ Resources:ResourceFile, Title%>"
            onclick="ShowConfirm(this.customText, this.customTitle)" runat="server" />
    Hope this helps.

    Petio Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Afework
    Afework avatar
    3 posts
    Member since:
    Jul 2011

    Posted 06 Dec 2011 Link to this post

    Using custom attributes works well in IE(Internet explorer) but not in Firefox, Chorme and other web browsers.
  4. Marin Bratanov
    Marin Bratanov avatar
    5929 posts

    Posted 07 Dec 2011 Link to this post

    Hi Afework,

    Please make sure you get the attributes correctly and pass them to the radconfirm properly. Using custom attributes is considered general knowledge and is actually not related to the RadControls - the RadConfirm will display the text you pass. If you do not provide a valid string you will naturally get a JavaScrtip error.

    I tested this scenario and I can suggest a safer way of getting attributes:
    <input id="Button1" type="button" value="ShowConfirm" 
       customText="<%$ Resources:ResourceFile, Text%>" 
       customTitle="<%$ Resources:ResourceFile, Title%>" 
       onclick="ShowConfirm(this.getAttribute('customText'), this.getAttribute('customTitle'))" runat="server" />

    I am also attaching my test page that seems to be working fine: http://screencast.com/t/9R4lkDSAB. Please compare it with yours and use this as base for your further development.

    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
Back to Top