关闭

Windows 应用程序 DataGrid数据绑定显示中文列名

728人阅读 评论(0) 收藏 举报

 

可以的private void SetDgTableStyle()
{//设置dgDisplay的显示格式,将英文格式转换成中文列名
//fldVehicleNum, fldMonthBillNum, fldVehicleType, fldStartDate, fldEndDate
DataGridTableStyle dgStyle = new DataGridTableStyle();
dgStyle.MappingName =this.dtFreevihecle.TableName ;

DataGridColumnStyle fldVehicleNum=new DataGridTextBoxColumn();
fldVehicleNum.MappingName = "fldVehicleNum";
fldVehicleNum.HeaderText = "车编号";
fldVehicleNum.Width = 100;
dgStyle.GridColumnStyles.Add(fldVehicleNum);

DataGridColumnStyle fldMonthBillNum=new DataGridTextBoxColumn();
fldMonthBillNum.MappingName = "fldMonthBillNum";
fldMonthBillNum.HeaderText = "月票号";
fldMonthBillNum.Width = 100;
dgStyle.GridColumnStyles.Add(fldMonthBillNum);

DataGridColumnStyle fldVehicleType=new DataGridTextBoxColumn();
fldVehicleType.MappingName = "fldVehicleType";
fldVehicleType.HeaderText = "免费类型";
fldVehicleType.Width = 100;
dgStyle.GridColumnStyles.Add(fldVehicleType);

DataGridColumnStyle fldVehicleTypePriceID=new DataGridTextBoxColumn();
fldVehicleTypePriceID.MappingName = "fldVehicleTypePriceID";
fldVehicleTypePriceID.HeaderText = "车价类型";
fldVehicleTypePriceID.Width = 100;
dgStyle.GridColumnStyles.Add(fldVehicleTypePriceID);

DataGridColumnStyle fldStartDate=new DataGridTextBoxColumn();
fldStartDate.MappingName = "fldStartDate";
fldStartDate.HeaderText = "开始时间";
fldStartDate.Width = 100;
dgStyle.GridColumnStyles.Add(fldStartDate);

DataGridColumnStyle fldEndDate=new DataGridTextBoxColumn();
fldEndDate.MappingName = "fldEndDate";
fldEndDate.HeaderText = "结束时间";
fldEndDate.Width = 100;
dgStyle.GridColumnStyles.Add(fldEndDate);
this.dgList.TableStyles.Clear();
this.dgList.TableStyles.Add (dgStyle);
}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1014次
    • 积分:20
    • 等级:
    • 排名:千里之外
    • 原创:0篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档