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
.
相关问题
- Is there a limit to how many levels you can nest i
- Sorting 3 numbers without branching [closed]
- How to toggle on Order in ReactJS
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
If
Visible
isfalse
, then the control did not go down to the client, so you cannot directly access it from javascript: it simply isn't there.Equally, since it is a
HiddenField
(i.e.<input type="hidden"...>
), there is no need to setdisplay:none
- it will never be visible, even ifVisible
istrue
(although, it will be in the source).So: either set
Visible
totrue
, or come back to the server to get that value.When you set
Visisble=false
on the server side it won't actually render the control in the page so there is no way to get the value on the client side.If you really can't put the value in the page some other way you could do an AJAX request to get the value when you need it?
You can't - these fields are not being rendered to the client side.