读书人

DataGridView列头的中文显示有关问题

发布时间: 2012-02-15 12:09:44 作者: rapoo

DataGridView列头的中文显示问题
数据库里的表的列名都是英文,例如 Department表里有ID Name 等
如何通过DataGridView显示成编号,名称呢?不能破坏数据库。

谢谢大家了~ 给点思路!

[解决办法]
this.dataGridView1.Columns[ "ID_RULEGROUP "].Visible = false;
this.dataGridView1.Columns[ "no_RULEGROUP "].HeaderText = "角色群编号 ";
this.dataGridView1.Columns[ "nm_RULEGROUP "].HeaderText = "名称 ";

this.txtRuleGruopId.DataBindings.Add( "Text ", bindMaster, "id_rulegroup ");
this.txtRuleGroupNo.DataBindings.Add( "Text ", bindMaster, "no_rulegroup ");
this.txtRuleGroupName.DataBindings.Add( "Text ", bindMaster, "nm_rulegroup ");
[解决办法]

在DataGridView右键-> 编辑列-> HeadText,此处为列显示的内容,可以不同于Name.

读书人网 >C#

热点推荐