C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Active Directory »

How to hide a control using javascript


Posted Date: 10 Mar 2008    Resource Type: Code Snippets    Category: Active Directory
Author: KalyanMember Level: Gold    
Rating: 1 out of 5Points: 10



The following code sample shows how to hide a control using javascript

document.getElementById("").style.visibility="hidden";



Responses

Author: Maheshkumar shende    10 Apr 2008Member Level: Silver   Points : 0
Your code is

document.getElementById("").style.visibility="hidden";

it will work fine for hiding the control but ones you hide it , i guess you will not able to make it visible again cause 'getElementById("")' will fail to find out the 'id' of hidden control

Try this

Hide

document.getElementById("").style.display="none";

Show

document.getElementById("").style.display="";

Thanks & Regards
Maheshkumar



Author: sujatha.m    30 Apr 2008Member Level: Bronze   Points : 2
You have to make it visible again (in formload)

document.getElementById("").style.visibility="visible";


Author: andy robarts    30 Apr 2008Member Level: Gold   Points : 2
Hide

document.getElementById("").style.display="none";

Show

document.getElementById("").style.display="";



Author: Samarth Abrol    01 May 2008Member Level: Bronze   Points : 2
The answer written in the first response is not actually 100% accurate.

We can hide/display the controls using

1) document.getElementById("").style.display="none"/document.getElementById("").style.display="inline"

or

2)
document.getElementById("").style.visibility="visible";/document.getElementById("").style.visibility="hidden";

The difference between the two is using the 1st option, we can hide the control and the space occupied by the controls also gets
removed, i.e if the controls has a certain height and is contained in a table row, the row gets collapsed and when displayed, the control will again take it's place.and the row will again retain its height by displaying the control in it.

On the other hand if we use 2nd option, the control will get hide
but the space occupied by the control will remain as it is and the row will not collapse, i.e the row will still be displayed
as blank containing the control in hidden mode.






Author: sanmu    01 May 2008Member Level: Bronze   Points : 2
Hide a control using javascript :


document.getElementById("").style.visibility="hidden";

show :

document.getElementById("").style.visibility="visibile";


Author: Nithya    02 May 2008Member Level: Bronze   Points : 2
document.getElementById("Controlname").style.Visibility="hidden"


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to display time with microseconds in C#.net
Previous Resource: Updating or deleting a single row in SQL Server
Return to Discussion Resource Index
Post New Resource
Category: Active Directory


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use