屏蔽gridview上的敏感信息并仅在鼠标悬停时显示。 [英] Masking sensitive information on gridview and showing it only on mouseover.

查看:81
本文介绍了屏蔽gridview上的敏感信息并仅在鼠标悬停时显示。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想要实现的目标 -

我有gridview with boundfields。

基本上我想从用户屏蔽UI上的一些敏感信息。

1.对于包含敏感信息的少数列,我想显示星号而不是实际绑定gridview的负载值。我仍然希望在某些gridview事件中访问原始绑定值。

2.在gridview中的单元格上进行mousover时,应显示原始边界值。在mouseout上,应再次显示星号。



这可能需要在服务器端c#代码和JavaScript之间传递复杂对象。



有没有实现这个目标的简单解决方案?



我尝试过:



可以使用rowdatabound事件实现上面的第1点。或者是boundfields的datastringformat属性。

但要实现第2点,gridview数据源或gridview本身应存储在某处。但我正在努力通过优雅的解决方案来实现这一目标。

Here is what I want to achieve-
I have gridview with boundfields.
Basically i want to mask some sensitive information on the UI from the user.
1. For few column with sensitive information, i would want to show asterisk instead of actual bound values on load of gridview. I still want to access original bound values in some gridview events.
2. On mousover on the cell in gridview, original bound values should be displayed. On mouseout, again asterisk should be displayed.

This might need to pass complex objects between server side c# code and JavaScript.

Is there any simple solution to achieve this?,

What I have tried:

Point 1 above can be achieved with rowdatabound event. Or datastringformat property for boundfields.
But to achieve point 2, gridview data source or gridview itself should be stored somewhere. But I am struggling to achieve this with elegant solution.

推荐答案

除了 BoundField 之外,还有 HiddenField 并将实际值存储在其中。在鼠标悬停时,在标签和 mouseout 中显示 HiddenField 值,隐藏该标签。
Beside BoundField, have a HiddenField and store the actual value in that. On mouseover, show that HiddenField value in a label and on mouseout, hide that label.


这篇关于屏蔽gridview上的敏感信息并仅在鼠标悬停时显示。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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