如何隐藏的列(GridView控件),但仍可以访问它的价值? [英] How to hide a column (GridView) but still access its value?

查看:143
本文介绍了如何隐藏的列(GridView控件),但仍可以访问它的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据源(SQL数据库)一个gridview。我想隐藏的列,但是当我选择记录仍可以访问值。有人能告诉我如何做到这一点?

I have a gridview with a datasource (SQL Database). I want to hide a column but still access the value when I select the record. Can someone show me how to do this?

这是我要隐藏的列,我也希望它的值:

This is the column I want to hide and I also want its value:

< ASP:BoundField的数据字段=Outlook_ID的HeaderText =OutlookID/>

我想尽一切办法隐藏列(属性Visible =假),但我不能访问它的价值。

I tried everything to hide the column (property Visible="false"), but I can't access its value.

感谢您提前。

推荐答案

如果我没有记错,GridView控件不认为有属性可见=假boundcolumns的值。 2事情你可以在这里做的,人们(比如从V4Vendetta答案解释)使用Datakeys。或者,您可以将绑定列更改为模板字段。而在项目模板,添加控件标签一样,让其知名度假的,给你的价值的标签。

If i am not mistaken, gridview does not hold the values of boundcolumns that have the attribute visible="false". 2 things you may do here, one (as explained in the answer from V4Vendetta) to use Datakeys. Or you can change your boundcolumn to a template field. And in the item template, add a control like label, make its visibility false and give your value to that label.

这篇关于如何隐藏的列(GridView控件),但仍可以访问它的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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