以下信息都是关于在法国显示语言的。但它没有显示任何数据,为什么?我尝试了很多方法,但没有用。我尝试了很多方法,但没有用。我尝试了很多方法,但没有用。
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" enableLocalization="true">
<siteMapNode ur!="~/Default2.aspx" title="$resources:SiteMapLocalizations,str1" description=""/>
</siteMap>
<asp:Menu ID="MnuSideMenu" CellPadding="0" CellSpacing="0" runat="server" Width="100%">
<DataBindings>
<asp:MenuItemBinding DataMember="siteMapNode" NavigateUrlField="url" TextField="title" />
</DataBindings>
</asp:Menu>
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
XmlDataSource oXmlDataSource = new XmlDataSource();
oXmlDataSource.XPath = "siteMap/siteMapNode";
oXmlDataSource.DataFile = Server.MapPath("~") + @"/siteMap/x.sitemap";
MnuSideMenu.DataSource = oXmlDataSource;
MnuSideMenu.DataBind();
}
protected override void InitializeCulture()
{
string languageId = "en-US";
if (!string.IsNullOrEmpty(languageId))
{
if (languageId.EndsWith("FR")) languageId = "fr-FR";
else languageId = "en-US";
SetCulture(languageId);
}
if (Session["Language"] != null)
{
if (!Session["Language"].ToString().StartsWith(Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName)) SetCulture(Session["Language"].ToString());
}
base.InitializeCulture();
}
protected void SetCulture(string languageId)
{
Session["Language"] = languageId;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(languageId);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(languageId);
}
protected void Button1_Click1(object sender, EventArgs e)
{
}