Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Hide button based on the role

Posted on 2006-05-05
Medium Priority
Last Modified: 2008-02-26
I have two roles : "Redayonly", "ReadandUpdate"

I've like to hide a update button on the page if the user is in "Readonly"Role.

How can I do this in the code behind page?  Can you prove me some code examples in C#?
Question by:jung1975
1 Comment
LVL 11

Accepted Solution

TornadoV earned 2000 total points
ID: 16617418
If you're using VS 2005:

if (Page.User.IsInRole("Readonly"))
       button.Visible = false;

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question