如何隐藏动态网格视图列? [英] How do I hide a dynamic grid view column?

查看:64
本文介绍了如何隐藏动态网格视图列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下代码,但是它不起作用.

I have tried the following code but it does not work.

GridView1.DataSource = SearchReader;
GridView1.DataBind();
GridView1.Columns[0].Visible = false;

推荐答案

添加最后一行

GridView1.Columns[0].Visible = false;

在GridView RowDataBound事件中,它应该可以工作,或者您可以在同一事件中为该列添加样式"visibility:none".
Add the last line

GridView1.Columns[0].Visible = false;

in GridView RowDataBound Event, it should work or you can add style "visibility:none" for that column in the same event.


您可以将其宽度设置为零吗?或者为该控件创建一个模板,该模板在该列中不显示数据(如果需要的话),但不显示.
You could set it''s width to zero perhaps ? Or create a template for the control which doesn''t show the data in that column, if you need it there, but not shown.


这篇关于如何隐藏动态网格视图列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆