根据gridview的标题绑定dropdownlist [英] bind dropdownlist according to the header of the gridview
本文介绍了根据gridview的标题绑定dropdownlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个下拉列表和gridview,我想根据网格视图的标题绑定下拉列表进行过滤。如果我有一个网格视图标题,如
I have a dropdownlist and the gridview and I want to bind the dropdownlist according to the header of the grid view for filter.If i have a grid view header like
productid | productname | Productcode | edit | delete
下拉列表的值应为
productid
产品名称
产品代码
请帮助
the dropdown should have values like
productid
productname
Productcode
please help
推荐答案
for (int i = 0; i < dataGridView1.ColumnCount; i++)
{
comboBox1.Items.Add(dataGridView1.Columns[i].HeaderText);
}
您好,
请参考此链接:
http://stackoverflow.com/questions/ 14260753 / get-the-gridview-column-header-text-always-returns-blank [ ^ ]
这篇关于根据gridview的标题绑定dropdownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文