要重命名数据网格视图的列 [英] want to rename the column of Data grid view
本文介绍了要重命名数据网格视图的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个datagridview并限制了我的数据源.
加载gridview时,列名称紧跟表属性名称.
示例:
catID desc catName
我想将该列重命名为Cat ID,描述,类别名称
我该怎么办?
请帮帮我.
在此先感谢.
Hi All,
I have a datagridview and have bounded my datasource.
When the gridview is loaded, the column name follows the table attributes name.
Example:
catID desc catName
I want to rename the column to Cat ID, Description, Category Name
How do I do that?
Please help me.
Thanks in Advance.
推荐答案
这是一种解决方案...
为每个列名称使用别名
内部查询U R将要执行
像这样..
Here is One Solution For That...
Use Alias Name for each Column Name
Inside Query that U R going to execute
Like This..
Select catID as Cat ID, desc as Description, catName as Category Name from UrTable
尽管我希望使用Prasad的解决方案,但如果您不想查询查询,可以尝试以下解决方案:
处理"ColumnAdded"事件,并根据
Though I would prefer Prasad''s solution but if you don''t want to touch your query, you can try below solution:
Handle "ColumnAdded" event and based on the
e.Column.DataPropertyName
属性可以设置
e.Column.HeaderText
属性.
这篇关于要重命名数据网格视图的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文