Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Hide Edit and New buttons in a formview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dennis - 27 Aug 2007 18:09 GMT
I have a basic formview with edit and new buttons.  I would like to
hide the buttons if the user is not a member of certain groups.  I
know the code looks like this, but I can't figure out where the code
needs to be called from because it errors if the controls don't
exist.

If Not
Roles.IsUserInRole(ConfigurationManager.AppSettings("PowerUsers"))
Then
   fvwCustomer.FindControl("EditButton").Visible = False
   fvwCustomer.FindControl("NewButton").Visible = False
End If

Any help is greatly appreciated.
Shaun Rigby - 27 Aug 2007 20:13 GMT
Dennis,

Have you tried placing it in an onLoad Event?

>I have a basic formview with edit and new buttons.  I would like to
> hide the buttons if the user is not a member of certain groups.  I
[quoted text clipped - 10 lines]
>
> Any help is greatly appreciated.
Dennis - 29 Aug 2007 19:19 GMT
> Dennis,
>
> Have you tried placing it in an onLoad Event?

Shaun, I had it in the Page onLoad.  I finally got around it by
removing the buttons from the formview and putting them on the page
itself.  But it still bugs me that I couldn't get it to work the other
way.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.