如果 Visibility 设置为 false,则访问隐藏字段值(使用 C#) [英] Access hidden fields value if its Visibility set to false(using C#)

查看:36
本文介绍了如果 Visibility 设置为 false,则访问隐藏字段值(使用 C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在服务器端使用 C# 访问隐藏字段的内容,其中 hiddenfiled 的可见性设置为 Visible=false.我不适合使用 CSS 的 display:none 而不是 Visible=false.

How can I access the content of hidden field, where the hiddenfiled's visibility set to Visible=false in the server side using C#. I am not in a situation to use CSS's display:none instead of Visible=false.

推荐答案

如果 Visiblefalse,那么控件没有下到客户端,所以你不能直接从 javascript 访问它:它根本不存在.

If Visible is false, then the control did not go down to the client, so you cannot directly access it from javascript: it simply isn't there.

同样,既然是一个HiddenField(即),就不需要设置display:none - 它不会永远可见,即使 Visibletrue (尽管它会在源代码中).

Equally, since it is a HiddenField (i.e.<input type="hidden"...>), there is no need to set display:none - it will never be visible, even if Visible is true (although, it will be in the source).

所以:要么将 Visible 设置为 true,要么返回服务器获取该值.

So: either set Visible to true, or come back to the server to get that value.

这篇关于如果 Visibility 设置为 false,则访问隐藏字段值(使用 C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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