<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
protected void btnSubmit_Click(object sender, EventArgs e)
{
lblMessage.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Simple Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button
id="btnSubmit"
Text="Click Here!"
OnClick="btnSubmit_Click"
Runat="server" />
<br /><br />
<asp:Label
id="lblMessage"
Text="Thank You!"
Visible="false"
Runat="server" />
</div>
</form>
</body>
</html>
A localizable version of the above page.
<%@ Page Language="C#" UICulture="auto" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
protected void btnSubmit_Click(object sender, EventArgs e)
{
lblMessage.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Localizable Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button
id="btnSubmit"
Text="<%$ Resources:ClickHere %>"
OnClick="btnSubmit_Click"
Runat="server" />
<br /><br />
<asp:Label
id="lblMessage"
Text="<%$ Resources:ThankYou %>"
Visible="false"
Runat="server" />
</div>
</form>
</body>
</html>
Associate a resource file with the page.
All the resource files that you want to associate with a page must be added to a special folder named App_LocalResources.
You create the App_LocalResources folder in the same folder as the page that you want to localize.
You associate a resource file in the App_LocalResources folder with a particular page by using the following file naming convention:
page_name.[culture name].resx
For example, all the following resource files are associated with the LocalizablePage.aspx page:
LocalizablePage.aspx.resx
LocalizablePage.aspx.es-PR.resx
LocalizablePage.aspx.es.resx
The first resource file is the default resource file.
Finally, the third resource file name includes the neutral culture name es (Spanish).
If a user's preferred language is Spanish, but not Puerto Rican Spanish, then the contents of this resource file are loaded.
File: App_LocalResources\LocalizablePage.aspx.es.resx
Name Value
ClickHere ccc
ThankYou ttt