如何在网格视图的标题列中加载表值 [英] how to load table values in header coloumn of grid view
本文介绍了如何在网格视图的标题列中加载表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我.
我在此表中有一个名为location的表,现在有值显示为showroom1,showroom2,godown等,我想将这些值加载到gridview的标题列中.我该怎么办.
谢谢.
Plz help me.
i have table named location in this table there are values as showroom1,showroom2,godown etc now i want to load these values in a header column of gridview. how can i do it.
Thanks.
推荐答案
将表绑定到Gridview并设置Auto Generated Column = True
Bind table to Gridview and set Auto Generated Column = True
,您可以像这样遍历数据网格:
对于每个col作为Me.yourDataGridView.Columns中的DataGridViewColumn
col.HeaderText =您的表值"
下一个
您可以通过遍历数据集来获取您的表值".
you can loop thru your data grid like this:
For Each col as DataGridViewColumn in Me.yourDataGridView.Columns
col.HeaderText = "your table values"
Next
you can get "your table values" by looping thru your dataset. if your using dataset to load your data.
谢谢,但是它向我显示了表的列,我是否需要表的值.
表< location>
Location_ID Location_Name
1陈列室1
2陈列室2
3 Godown
4等
5等
我需要在gridview标头中使用showrrom1,showroom2等.
谢谢
Thanks, but it shows me column of the table whether i need values of table.
Table <location>
Location_ID Location_Name
1 Showroom1
2 Showroom2
3 Godown
4 etc
5 etc
i need showrrom1, showroom2 etc at gridview header.
Thanks
这篇关于如何在网格视图的标题列中加载表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文