Code-behind check to see if a control has been set to display: none?

I currently have a control that is being hidden on my server side using dropdown.hide();.

hide() is a server-side method I created to hide my methods, e.g.

control.Style["display"] = "none";

How can I tell, on the server-side, if my control is hidden or not?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’m guessing you don’t mean just doing:

if (control.Style["display"] == "none") { .... }

And that you want to know after a postback? If that’s the case, then you can’t do it, unless you store the fact it’s hidden in a hidden input or something like that, using JavaScript.

Method 2

Just check if control.Style["display"] == "none"

If it is changed on the clientside you have to save the state so it will be sent by the POST action. You can save the state in a hiddenfield or using AJAX?


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x