Dynamic gridview content based on user role?

Discussion in 'ASP .Net Security' started by Troy Dot Net, Jan 9, 2006.

  1. Troy Dot Net

    Troy Dot Net Guest

    I have a page that displays SQL Server tables via GridView controls.
    However, some of the table fields (gridview columns) should be visibile only
    to specific users (Admin, Supervisors, etc) and some should be
    visible/editable only by specific users (Admin). I would like a simple,
    robust method of dynamically enabling/disabling content based on the user's
    role. I'm using ASP.Net 2.0/C# within VS2005TS and SQL Server 2000 (can also
    use 2005 express).

    Any suggestions? Thanks for your advice.

    Troy
     
    Troy Dot Net, Jan 9, 2006
    #1
    1. Advertising

  2. Troy Dot Net

    MikeS Guest

    Will something like this work?
    <control enabled='<%=Roles.IsCallerInRole("Admin")%>'>
     
    MikeS, Jan 22, 2006
    #2
    1. Advertising

  3. Troy Dot Net

    Troy Dot Net Guest

    > Will something like this work?
    > <control enabled='<%=Roles.IsCallerInRole("Admin")%>'>


    I believe that will work, though that's the easy part. The hurdle is how to
    define which controls require which role(s) to be viewable and which controls
    require which role(s) to be editable (and maybe again for deleteable).
    Making this system scaleable, foolproof and manageable is the hard part.

    Thanks for the lead.

    Troy
     
    Troy Dot Net, Jan 23, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jesper Stocholm
    Replies:
    2
    Views:
    8,122
    John Saunders
    Aug 23, 2003
  2. Liet Kynes
    Replies:
    0
    Views:
    500
    Liet Kynes
    Nov 26, 2003
  3. Sri Reddy
    Replies:
    3
    Views:
    365
    Jules
    Jun 21, 2006
  4. Kursat
    Replies:
    1
    Views:
    323
    Dominick Baier
    May 7, 2007
  5. Preben
    Replies:
    1
    Views:
    96
    James Britt
    Mar 2, 2006
Loading...

Share This Page