Window - Localization

Demo Configurator

Choose language


Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadWindow and RadWindowManager provide a mechanism for quick and easy localization, based on the native ASP.NET 2.0 localization. All UI strings for command buttons are obtained from the resource files located in the WebSite's App_GlobalResources directory, so that the language of the RadWindow is automatically switched to the culture and UI culture of the Web page.

The name of the resource file (RadWindow in this case) and the string to read must be specified in the Localization property for each of the tooltips/buttons you wish to localize (in this demo the string name matches the command name/button text).

The example uses the approach described in this Microsoft help article to programmatically change the culture and UI culture of an ASP.NET Web page.

Each of the localization strings can be modified at runtime using the Localization property. This saves the need to create a new localization file to change a single string.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Window.Localization.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="theFormDecorator" runat="server" DecoratedControls="Buttons" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rblLanguages">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="rblLanguages"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindowManager RenderMode="Lightweight" OffsetElementID="demoContainer" ID="RadWindowManager1" runat="server" EnableShadow="true">
        <Localization Maximize="<%$ Resources:RadWindow, Maximize %>" Minimize="<%$ Resources:RadWindow, Minimize %>"
            Close="<%$ Resources:RadWindow, Close %>" PinOff="<%$ Resources:RadWindow, PinOff %>"
            PinOn="<%$ Resources:RadWindow, PinOn %>" Reload="<%$ Resources:RadWindow,Reload %>"
            Restore="<%$ Resources:RadWindow, Restore%>" Cancel="<%$ Resources:RadWindow, Cancel %>"
            OK="<%$ Resources:RadWindow, OK %>" No="<%$ Resources:RadWindow, No %>" Yes="<%$ Resources:RadWindow, Yes %>"></Localization>
        <Windows>
            <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" VisibleOnPageLoad="true" Width="320" Left="230" Top="40" NavigateUrl="http://www.telerik.com">
            </telerik:RadWindow>
            <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow2" runat="server" Width="320" VisibleOnPageLoad="true" Left="580" Top="40">
                <ContentTemplate>
                    <div style="text-align: center;">
                        <h3>RadWindow with ContentTemplate set!</h3>
                        <asp:Image ID="img" runat="server" ImageUrl="~/Window/TestPage/TestPageResources/RadWindow.gif"
                            Style="width: 220px; height: 46px;" alt="RadWindow logo"></asp:Image>
                    </div>
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <div class="demo-container" id="demoContainer">
        <ul class="controlButtons" style="min-height: 340px;">
            <li>
                <button onclick="return OpenAlert()">Open radalert</button></li>
            <li>
                <button onclick="return OpenPrompt()">Open radprompt</button></li>
            <li>
                <button onclick="return OpenConfirm()">Open radconfirm</button></li>
        </ul>
    </div>
    <qsf:ConfiguratorPanel ID="ConfiguratorPanel1" runat="server">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Size="Medium" Title="Choose language">
                    <qsf:RadioButtonList ID="rblLanguages" runat="server" AutoPostBack="True" CssClass="radio-list-h">
                        <asp:ListItem Value="de-DE">Deutsch</asp:ListItem>
                        <asp:ListItem Selected="true" Value="en-US">English</asp:ListItem>
                        <asp:ListItem Value="fr-FR">Francais</asp:ListItem>
                    </qsf:RadioButtonList>
                </qsf:ConfiguratorColumn>
                <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
                    <input type="hidden" name="cultureRadioList" value="<%= rblLanguages.UniqueID %>" />
                </telerik:RadCodeBlock>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?