Hiding and Showing User Control Dynamically

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
 
S

S. Justin Gengo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top