Hiding and Showing User Control Dynamically

  • Thread starter Thread starter John Kraft
  • Start date Start date
J

John Kraft

Hey guys,

I created a little user control that is basically a table with a login
and password field. I have this control on all my pages, but I want to
hide it or show it based on whether or not the person viewing the page
has logged in. I can't seem to get it to work.

I put a condition in the PageLoad function fo the control that says:
if context.user is nothing then
me.visible = true;
else
me.visible = false;
end if

I am obviously way off on this logic. What do I need to do to make this
work.

John
 
John,

Context.User will always return true. This is a reference to an object that
the page creates no matter what. You might want to base this on
Context.User.IsInRole instead (If you are assigning user roles.)

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Back
Top