1, create a new two resources file in the Web site as follows
File information in the Resources.resx
File information in the Resources.en-us.resx
Default.aspx's Code
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default" culture= "Auto" Uiculture= "Auto"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>global_Resource</title>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:calendar id= "Calendar1" runat= "Server" ></asp:Calendar>
<asp:button id= "Button1" runat= "Server" onclick= "Button1_Click" text= "confirmation"/>
<asp:label id= "Label1" runat= "Server" text= "Label" ></asp:Label></div>
</form>
</body>
Default.aspx.cs's Code
Code
Copy code code as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{
Page.title = Resources.Resource.pagefile;
Response.Write (resources.resource.question+ "<br/>");
}
protected void Button1_Click (object sender, EventArgs e)
{
int days = Datetime.now.dayofyear-calendar1.selecteddate.dayofyear;
if (Days > 0)
{
Label1.Text = string. Format (Resources.Resource.Answer, (365-days). ToString ());
}
Else
Label1.Text = string. Format (Resources.resource.answer,math.abs). ToString ());
}
}
The results of the operation are as follows:
Note the value of the property in the culture in the Default.aspx file
And when you want your browser to display Web page content in Chinese language, you can set it in the browser using the tools-> Interner options-> language