Hide Edit and New buttons in a formview

D

Dennis

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.
 
D

Dennis

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top