当前位置:编程学习 > C#/ASP.NET >>

asp.net多语言化中遇到的问题

我想实现页面的多语言化,页面中GRIDVIEW的名称我已用HeaderText="<%$ Resources:Page, CustomerID %>"实现

但页面中还有一个Gridview, 它的名称
var orders = from s in db.Order
from p in db.Order_Detail
from t in db.Customer
where s.CustomerID == str
&& s.OrderID == p.OrderID
&& t.CustomerID == str
select new
{
    CustomerName = t.CompanyName,
    OrderDate = s.OrderDate,
    RequiredDate = s.RequiredDate,
    UnitPrice = p.UnitPrice
};我是这样实现的,所以在切换语言时这个gridview的text不能改变
请问有什么办法解决么?谢谢大家了 --------------------编程问答-------------------- 读取的后台数据不能转换吗? --------------------编程问答-------------------- 先写资源文件,放在App_GlobalResources文件下面。
<asp:Label ID="Label10" runat="server" Text="<%$ Resources:lang,aboutus%>"></asp:Label>
进行绑定,在Global.asax文件里写入cookieC# code void Application_BeginRequest(object sender, EventArgs e)
  {
  try
  {
  if (Request.Cookies["lang"] != null)
  {
  System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(Request.Cookies["lang"].Value.ToString());
  System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Request.Cookies["lang"].Value.ToString());
  }
  }
  catch (Exception)
  { }  
  }
--------------------编程问答-------------------- 我是想要把 CustomerName   =   t.CompanyName,中的CustomerName   用resource里设定好的代替,就是代码一直报错
 
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,