数据网格中的关键列 [英] keycolumns in data grid

查看:97
本文介绍了数据网格中的关键列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在数据网格中有一个关键列.例如EmpID.

目前,我正在显示此列.但是,我不想在网格中显示此值.我只想隐藏列.

如果我隐藏此列,则键值将不会用于更新和删除记录.

我只是想隐藏键列,但是,值应读取.

我想做什么..?

问候,
Ganesh.S

Hi,

I have one keycolumns in data grid. for example EmpID.

currently i am displaying this columns. but, i don''t want to make visible in the grid this values. just i want to hide the columns.

If i hide this columns, the keyvalue will not come for update and delete the records.

Just i want to hide the keycolumns, but, the values should read.

What i want to do..?

Regards,
Ganesh.S

推荐答案

基本上,您需要捕获RowCreated事件,并将要隐藏的单元格的Visible属性设置为false.请参阅此简短博客 [ ^ ].它引用了此教程 [
Basically, you need to trap the RowCreated event and set the cell''s Visible property to false for the cells that you want to hide. Please see this short blog[^]. It references this tutorial[^] which talks about why the solution works.


使用 DataKeyNames [ ^ ].如果隐藏列,则不会在代码中获得该值.
因此,请使用DataKeyNames.这是很好的方法.

检查以下链接.这将帮助您如何获取值.

http://www.mindfiresolutions.com/DataKeys-and- DataKeyNames-Property-of-Listview-或Gridview-479.php [ http://www.codedigest.com/Articles/ASPNET/212_How_to_edit_and_Delete_records_in_a_grid <[ "http://www.codedigest.com/Articles/ASPNET/212_How_to_edit_and_Delete_records_in_a_gridview_using_datakeys.aspx" target ="_ blank" title =新窗口"> ^ ]
Use DataKeyNames[^]. If you hide a column, you will not get that values in code.
So use DataKeyNames. This is the good way of doing.

Check the following links. This will help you how to get the values.

http://www.mindfiresolutions.com/DataKeys-and-DataKeyNames-Property-of-Listview-or-Gridview-479.php[^]

http://www.codedigest.com/Articles/ASPNET/212_How_to_edit_and_Delete_records_in_a_gridview_using_datakeys.aspx[^]


这篇关于数据网格中的关键列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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