Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

how to hide controls on an aspx web page using tags with an if then statement?

Hi Experts. I have some hyperlink controls that are located in a table on my web form. I need to hide these hyperlinks under certain conditions. I did something similar a few years ago, but cannot remember how I did it.

In my .Aspx code I had an if style statement that would allow me to hide or display certain controls. Does anyone know how to do this using .aspx tags? I don't recall how to do it?
Avatar of xav056
xav056

do it from code behind
Avatar of brgdotnet

ASKER

Hi xav056, I would prefer to do it in the code behind, but the architect wants it done in the aspx page. It can be done using tags <   > somehow, but I don't know how.
ASKER CERTIFIED SOLUTION
Avatar of xav056
xav056

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
document.getElementById('<%=yourControlName.ClientId %>').display='none';
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sybe
This works fine in aspx pages, although <condition> must be declared as Public in codebehind.

<%If condition Then%>

<%End If%>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial