得到的GridView隐藏列的值 [英] Get the value of hidden column in Gridview

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

问题描述

我使用一个GridView,不知道是否有办法隐藏在GridView列,但仍然能够访问隐伏列的值。

I am using a Gridview and wondering if there is way to hide a column from the Gridview but still be able to access the hiden column value.

我设置的visible = false,我想隐瞒,但是当我试图让该列的值,在coulumn值为空列。

I set visible= false for the column that I want to hide but when I try to get the value of the column, the value in the coulumn is empty.

感谢。

推荐答案

我已经使用的DataKeyNames属性得到来自看不见的GridView的列值的方法之一。

One way I have gotten values from Invisible GridView Columns is using the DataKeyNames attribute.

<asp:GridView runat="server" ID="GridView" DataKeyNames="ColName1, ColName2">
</asp:GridView>

然后访问数据

var data = GridView.DataKeys[RowIndex].Values[KeyIndex]

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

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