This is a migrated thread and some comments may be shown as answers.
RadWindow confirm dialog localization with resource files.
3 Answers 80 Views
This is a migrated thread and some comments may be shown as answers.
Eric Routhier
Top achievements
Rank 1
Eric Routhier asked on 23 Jul 2010, 08:09 PM
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: 
ResourceFile
.TranslatedPrompt %> + ", event, 330, 100, '', " + <%$ Code: 
ResourceFile
.
TranslatedTitle 
 %> + ");"


Thank you !

3 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 29 Jul 2010, 12:13 PM
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">
    <title></title>
    <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");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
    <div>
     <input type="button" value="ShowConfirm" 
        customText="<%$ Resources:ResourceFile, Text%>"
        customTitle="<%$ Resources:ResourceFile, Title%>"
        onclick="ShowConfirm(this.customText, this.customTitle)" runat="server" />
    </div>
    </form>
</body>
</html>
Hope this helps.

Regards,
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
0
Afework
Top achievements
Rank 1
answered on 06 Dec 2011, 08:01 AM
Using custom attributes works well in IE(Internet explorer) but not in Firefox, Chorme and other web browsers.
0
Marin Bratanov
Telerik team
answered on 07 Dec 2011, 05:15 PM
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.

Regards,
Marin
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
Asked by
Eric Routhier
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Afework
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or