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. General Programming
  3. .NET (Core and Framework)
  4. Controlling visibility of controls in a single web form for two different user groups

Controlling visibility of controls in a single web form for two different user groups

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestioncsharpworkspace
4 Posts 3 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.
  • R Offline
    R Offline
    Renukapadhamanaban
    wrote on last edited by
    #1

    Hi, Iam new to .Net programming and this problem is keeping me ideal for last few days. I like to read the Roles list from the configuration file for a particular form to control the visibility of the web controls. My web.Config has authorisation like this: But inside that locatiion i have many forms and in one form i need to make few fields invisible for roles Doctors alone. How can i achieve this? if it is not possible by reading configuration file then please give me some other way of doing it. Am using .Net 1.1. I am looking forward some help. Thanks Renu

    M J 2 Replies Last reply
    0
    • R Renukapadhamanaban

      Hi, Iam new to .Net programming and this problem is keeping me ideal for last few days. I like to read the Roles list from the configuration file for a particular form to control the visibility of the web controls. My web.Config has authorisation like this: But inside that locatiion i have many forms and in one form i need to make few fields invisible for roles Doctors alone. How can i achieve this? if it is not possible by reading configuration file then please give me some other way of doing it. Am using .Net 1.1. I am looking forward some help. Thanks Renu

      M Offline
      M Offline
      manish24
      wrote on last edited by
      #2

      Hi U can use the session variable. When use logs in , set the role of that user in session variable. While displaying the forms, check the value of session variable & display appropriate controls Regards Manish

      R 1 Reply Last reply
      0
      • M manish24

        Hi U can use the session variable. When use logs in , set the role of that user in session variable. While displaying the forms, check the value of session variable & display appropriate controls Regards Manish

        R Offline
        R Offline
        Renukapadhamanaban
        wrote on last edited by
        #3

        Hi Manish, Thank you so much for your time. Actually there is another thing i need to consider. I will explain the situation with example: A user may be under more than one user group and each group has different functionality. User1 is under Role1 and Role2 User2 is only under Role2 The specified location can have access by both role1 and role2, but user from only role2 cannot have access to few fields in a page. So far am having user's role saved in FormAuthenticationTicket as DataUser and i need to check their Roles list with the list specified under the configuration tag to make sure the user is only under role2 to invisible the fields. I hope it explains well. Now is it possible reading config file's ? if so, please tell me how. If not could you please give me few other suggestion to achieve it? Expecting reply... Thanks Renu

        1 Reply Last reply
        0
        • R Renukapadhamanaban

          Hi, Iam new to .Net programming and this problem is keeping me ideal for last few days. I like to read the Roles list from the configuration file for a particular form to control the visibility of the web controls. My web.Config has authorisation like this: But inside that locatiion i have many forms and in one form i need to make few fields invisible for roles Doctors alone. How can i achieve this? if it is not possible by reading configuration file then please give me some other way of doing it. Am using .Net 1.1. I am looking forward some help. Thanks Renu

          J Offline
          J Offline
          Jim Conigliaro
          wrote on last edited by
          #4

          In the ASP.NET 1.0 framework, the Page class has a "User" property. That property has an "IsInRole" method which returns a Boolean value indicating if the logged in user is in the given role. This could be used to set the visibility of your fields: myControl.Visible = this.User.IsInRole("Doctor"); Jim Conigliaro jconigliaro@ieee.org

          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