Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.net MVC 4 Panel visible true/false depends on the condition

ASP.net MVC 4 Panel visible true/false depends on the condition

Scheduled Pinned Locked Moved ASP.NET
asp-nethelpcsharparchitecturelearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VishwaKL
    wrote on last edited by
    #1

    Hi guys, I am beginner in MVC 4, I am facing problem to achieve one simple requirement. The problem described as below. I have 3 roles(Programmer,reviewer,Admin) and 1 razor view, that has 4 panels and each panel has set of controls , depends on the role and the some condition i have to make panels visible false/true. Please help me out. Thanks and regards Vishwa

    R 1 Reply Last reply
    0
    • V VishwaKL

      Hi guys, I am beginner in MVC 4, I am facing problem to achieve one simple requirement. The problem described as below. I have 3 roles(Programmer,reviewer,Admin) and 1 razor view, that has 4 panels and each panel has set of controls , depends on the role and the some condition i have to make panels visible false/true. Please help me out. Thanks and regards Vishwa

      R Offline
      R Offline
      Rohith Reddy Vadiyala
      wrote on last edited by
      #2

      In the Mvc application we can find ASPNETDB.MDF in Server Explorer. Add roles (Programmer,reviewer,Admin) and its users to respective tables. Now based on the logged-in user's role we can make panel visible property true or false. Sample Code:

      if (User.IsInRole("Administrator"))
      adminPanel.Visible=True;

      I hope this will help you. Please accept it as answer if it helped you.

      With Regards, Rohith.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups