Access Hidden Fields Value If Its Visibility Set To False(using C#)
Solution 1:
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.
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).
So: either set Visible
to true
, or come back to the server to get that value.
Solution 2:
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?
Solution 3:
You can't - these fields are not being rendered to the client side.
Post a Comment for "Access Hidden Fields Value If Its Visibility Set To False(using C#)"