本地化ASPXPivotGrid控件
当AspxPivotGrid中有统计行的时候,默认会后面加上 Total 的字样,或者是显示 Grand Total等字样. 如果要改变这些字的话,可以这样做.
1.首先继承一个PivotGridLocalizer 或ASPxPivotGridResLocalizer的子类,并覆盖GetLocalizedString方法.
2.在PrivotGrid初始化之前把这个继承的类赋给PivotGridLocalizer 的Active属性.
代码类似如下:
using System;
using System.Web.UI;
using DevExpress.Data.PivotGrid;
using DevExpress.Web.ASPxPivotGrid;
using DevExpress.XtraPivotGrid.Localization;
public partial class _Default : System.Web.UI.Page
{
class CustomLocalizer : ASPxPivotGridResLocalizer
{
public override string GetLocalizedString(PivotGridStringId stringId)
{
switch (stringId)
{
case PivotGridStringId.GrandTotal:
return "全部";
case PivotGridStringId.TotalFormat:
return "{0} 全部";
default:
return base.GetLocalizedString(stringId);
}
}
}
public _Default()
{
PivotGridLocalizer.Active = new CustomLocalizer();
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
using System.Web.UI;
using DevExpress.Data.PivotGrid;
using DevExpress.Web.ASPxPivotGrid;
using DevExpress.XtraPivotGrid.Localization;
public partial class _Default : System.Web.UI.Page
{
class CustomLocalizer : ASPxPivotGridResLocalizer
{
public override string GetLocalizedString(PivotGridStringId stringId)
{
switch (stringId)
{
case PivotGridStringId.GrandTotal:
return "全部";
case PivotGridStringId.TotalFormat:
return "{0} 全部";
default:
return base.GetLocalizedString(stringId);
}
}
}
public _Default()
{
PivotGridLocalizer.Active = new CustomLocalizer();
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
相关文章: http://www.devexpress.com/Support/Center/p/Q307806.aspx