Search code examples
jqueryvb.netcheckboxvisible

hide checkbox with jQuery, then check on server side if it's visible


I have a few asp:CheckBox's on my page.
I'm using jQuery to hide some of them (in various ways).
Then, pressing a submit button brings me to the server-side, where i'm trying to determine (in various ways) if a specific checkBox is visible or not.
But for some reason, in server-side all checkboxes are always visible! how do I know which are hidden?

client code - either one of these:

$("#cb1").hide(); 
$("#cb1").css("display", "none"); 
$("#cb1").css("visibility", "hidden"); 

server code - either one of these:

myCheckBox.Visible               '- always True 
myCheckBox.Attributes("display") '- always "nothing" 
myCheckBox.Style("visibility")   '- always "nothing" 
myCheckBox.Style("visible")      '- always "nothing"

Solution

  • You are submiting a form, right? When you hide the checkbox, change it's value. Then, server-side, check for that value. I don't know if ASP can check for style attributes, but since it's a GET or POST, it can get the value.