Re: Hiding labels and textboxs in formview templates according to role
- From: Dominick Baier <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 14 May 2007 21:50:51 +0000 (UTC)
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
.
- Prev by Date: Re: Hiding labels and textboxs in formview templates according to
- Next by Date: Re: Hiding labels and textboxs in formview templates according to
- Previous by thread: Re: Hiding labels and textboxs in formview templates according to
- Next by thread: Re: Hiding labels and textboxs in formview templates according to
- Index(es):
Relevant Pages
|
|