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