• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Show control if user logged in

Hello experts,

I currently have two <Div>s, I want to display one or the other if a user is logged in or not.

1. What controls should I place the <Div>s in. (LoginView is not an option)
2. What is the code in my codebehind that I will use to display one or the other dependent on the criteria being met

Many Thanks
1 Solution
      Use the Panel Control

string UserName = User.Identity.Name;
        if (UserName != "")
            panelMember.Visible = true;
            panelNonMember.Visible = false;
            panelMember.Visible = false;
            panelNonMember.Visible = true;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now