Click here to Skip to main content
16,015,923 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi,

I have a asp.net web page in which I have a
C#
asp:Checkbox


During Page load, I want the Checkbox as well as the Text to be in hidden state.
I want this to be done using JavaScript as I need to use it in furthur logic.

Please let me know ur ideas.

Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Sep-13 10:57am    
[no name] 17-Sep-13 11:22am    
Well whatever you have tried so far, I would be reasonably certain that you did not use C to do it.
JoCodes 17-Sep-13 12:39pm    
Yes. Why C was tagged for this particular question?

1 solution

XML
Try like the below code snippet for javascript implementation
window.onload(function(){
var cntrl= document.getElementById('<%= YourControlID.ClientID %>');
cntrl.style.display = 'none';
});
or

document.onload(function(){
var cntrl= document.getElementById('<%= YourControlID.ClientID %>');
cntrl.style.display = 'none';
});

Hope this helps.
 
Share this answer
 
Comments
Dev_TechnoLabs 29-May-17 5:21am    
what about the label for object which renders after input type checkbox object. it always appears with input type checkbox when you provide checkbox text property.please, anyone, don't say find next sibling and make is displayed none.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900