如何使某些列在GridView中不可见 [英] how to make certain column invisible in gridview
本文介绍了如何使某些列在GridView中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨盖兹,
我怎样才能使某个列保持不可见状态,但仍然可以访问数据,该数据来自数据库,并且我将其动态绑定到gridview中,请帮助
提前thnk
hi guyz,
how can i make a certain column invisbile but still i can access data, the data comes from database and i bind it in gridview dynamically, pls help
thnk in advance
推荐答案
在这里您要走
在ASP.NET中隐藏GridView列 [ ^ ]
您还可以针对该特定列尝试使用"style:display:none;"
之类的CSS
Here you go
Hide GridView Columns In ASP.NET[^]
Also you try CSS like"style:display:none;"
for that particular column(s)
,为此目的,可以从数据库访问记录并照常绑定到gridview.绑定gridview后,仅将DataGridViewColumn类的可见属性设置为False,如下所示:
For this purpose access records from database and bind to gridview as usual. Only set visible property of DataGridViewColumn class as False after binding gridview as below:
DataGridViewColumn column2 = dataGridView1.Columns[1]; // to hide 2nd column
column2.Visible = false;
希望对您有所帮助.
Hope this will help you.
尝试
gridview1.Columns[index].Visible = false;
这篇关于如何使某些列在GridView中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文