Tag Archives: css

There are several ways to show/hide ASP.NET controls, one option is server side using the Visible attribute. However, if you need to control the visibility via JavaScript, the easiest way is with CSS. See the following code:

function ShowHideElement(idText, hide)
{
    var lblText = document.getElementById(idText);
    if (lblText == null) return;
    if(hide)
    {
        lblText.style.visibility = "hidden";
    }
    else
    {
        lblText.style.visibility = "visible";
    }
}