隐藏的GridView自动生成列 [英] Hide Autogenerated Column in Gridview

查看:155
本文介绍了隐藏的GridView自动生成列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用自动生成的列,因为用户可以选择列在查询中返回一个gridview。我想隐藏的身份列。如何隐藏自动生成的列?即使在数据绑定事件中的列数是零。

I have a gridview that uses autogenerated columns, because the user can select the columns to return in a query. I want to hide the column with the identity. How do I hide the autogenerated column? Even in the databound event the columns count is zero.

推荐答案

我发现了如何做到这一点。您需要使用RowDataBound事件和隐藏单元格时该行的约束。

I discovered how to do this. You need to use the rowdatabound event and hide the cell when the row is bound.

Protected Sub ResultGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ResultGrid.RowDataBound
        e.Row.Cells(1).Visible = False
End Sub

这篇关于隐藏的GridView自动生成列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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