Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
ASP.NET Reference
 Localize Web Server Control Declara...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework General Reference
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"
/>

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.

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.

Visual Basic
<%@ 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  >
<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>
C#
<%@ 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  >
<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>

Reference

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker