Re: Hiding labels and textboxs in formview templates according to role



You have to use the FindControl method on the template. Add a trace="on" page directive to get a better understanding of the contol nesting on the page.

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

I have a formview with templates. I want to hide certain labels or
textboxes according to the user's role membership. I can do this in a
sub routine as long as it's not inside a template, is it possible to
do this inside a formview template?

Some code sample that does not work: (passphrase is the name of the
label)

Protected Sub passPhrase_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
If (Roles.IsUserInRole("networkServices")) Then
FormView1.itemtemplate.passphrase.visible = True
Else
FormView1.itemtemplate.passphrase.visible = False
End If
End Sub
Thank you for your time.

Ann



.



Relevant Pages

  • Re: Hiding labels and textboxs in formview templates according to role
    ... according to the user's role membership. ... I can do this in a sub routine as ... formview template? ... Have you added the event handler delegate for the init event? ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Using FP 2003 Dynamic Templates with WSS Sites
    ... However, when I do change a WSS created page into a Dynamic Template page, I ... imported or used in a WebPartZone control. ... to hear a second opinion from someone who has a better understanding of the ...
    (microsoft.public.sharepoint.portalserver)
  • Re: excel payroll calculator for canadians
    ... Can you post the link to the template you mentioned, ... Am I correct in my understanding, you want to be able to, for example, ... input a monetary amount, and have the neccessary deductions calculated? ... VBAvirgin's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=16327 ...
    (microsoft.public.excel.newusers)
  • Re: Site Area Templates
    ... My understanding is that you want to know how to ... Subject: Site Area Templates ... but how do I either add a new template or change formatting of existing ... > Microsoft Online Partner Support ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Replacing a control dymamically (to use a webform as a template)
    ... understanding what may be wrong. ... "jorge" wrote in message ... I could do it directly on the template webform, ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)