Note: This class is new in the .NET Framework version 2.0.
Reserves a location on a Web page in which to display localized static text.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Visual Basic (Declaration)
Public Class Localize
Inherits Literal
public class Localize : Literal
public ref class Localize : public Literal
public class Localize extends Literal
public class Localize extends Literal
Use the Localize control to reserve a location on a Web page in which to display localized text. The Localize control inherits from the Literal control and is identical to it in every way. The Localize control is used at design time to distinguish static text that can be localized from other static text. Although the Label control allows you to apply a style to the displayed text, the Localize control does not. You can programmatically manage the text displayed in the control by setting the Literal.Text property, inherited from the Literal control.
The following code example demonstrates how to use the Localize control to display static text.
Note |
|---|
| The following code example uses the single-file code model and might not work correctly if copied directly into a code-behind file. This code example must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model. |
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
Sub ButtonClick(ByVal sender As [Object], ByVal e As EventArgs)
Localize1.Text = "Welcome to ASP.NET!! This is localized text."
End Sub 'ButtonClick
</script>
</head>
<body>
<form id="Form1" runat="server">
<h3>Localize Example</h3>
<asp:Localize id="Localize1"
Text="Hello World!!"
runat="server"/>
<br><br>
<asp:Button id="Button1"
Text="Change Localize Text"
OnClick="ButtonClick"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ButtonClick(Object sender, EventArgs e)
{
Localize1.Text="Welcome to ASP.NET!! This is localized text.";
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<h3>Localize Example</h3>
<asp:Localize id="Localize1"
Text="Hello World!!"
runat="server"/>
<br><br>
<asp:Button id="Button1"
Text="Change Localize Text"
OnClick="ButtonClick"
runat="server"/>
</form>
</body>
</html>
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.Literal
System.Web.UI.WebControls.Localize
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
.NET Framework
Supported in: 2.0