Share via


Localize Web Server Control Declarative Syntax

Creates a location on a Web page to display localized, static text.

<asp:Localize
    EnableTheming="True|False"
    EnableViewState="True|False"
    ID="string"
    Mode="Transform|PassThrough|Encode"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    runat="server"
    SkinID="string"
    Text="string"
    Visible="True|False"
/>

Remarks

Use the Localize control to reserve a location on a Web page to display localized text. The Localize control is identical to the Literal control and similar to the Label control. While the Label control allows you to apply a style to the displayed text, the Localize control does not. You can programmatically control the text that is displayed in the Localize control by setting the Text property, which is inherited from the Literal control.

Example

The following code example demonstrates how to use the Localize control to localize a block of static text. Page resources in the App_LocalResource folder are used to customize the text for different languages.

<%@ Page Language="VB" 
     Culture="auto" 
     meta:resourcekey="PageResource1" 
     UICulture="auto" %>
<!DOCTYPE html PUBLIC 
     "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Localize Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Localize id="Localize1"
     runat="server" 
     meta:resourcekey="Localize1Resource1" 
     Text="Hello World!">
</asp:Localize>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" 
     Culture="auto" 
     meta:resourcekey="PageResource1" 
     UICulture="auto" %>
<!DOCTYPE html PUBLIC 
     "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Localize Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Localize id="Localize1"
     runat="server" 
     meta:resourcekey="Localize1Resource1" 
     Text="Hello World!">
</asp:Localize>
</div>
</form>
</body>
</html>

See Also

Reference

Localize