Re: Hiding labels and textboxs in formview templates according to
- From: Dominick Baier <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 15 May 2007 05:13:09 +0000 (UTC)
you should be aware that even if a label/textbox whatever is invisible - when you add data to it it will end up in viewstate. In addition to not showing the control - it should also not contain data.
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
Yes, that worked! Thanks
"Alexey Smirnov" wrote:
On May 14, 10:52 pm, Ann <A...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Yes, I have added the event handler. The problem is it doesn't likeI think, it's simple then
my syntax that I'm using, and I don't know what the correct syntax
should be for the path.
It doesn't like "FormView1.itemtemplate.passphrase.visible" I get
this error: BC30456: 'passphrase' is not a member of
'System.Web.UI.ITemplate'.
Try something like
Protected Sub passPhrase_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim x As Label = CType(sender, Label)
If (Roles.IsUserInRole("networkServices")) Then
x.visible = True
Else
x.visible = False
End If
End Sub
You can also try to use
<asp:Label ... visible=<% #IsAdmin() %>
Public Sub IsAdmin() as Boolean
If (Roles.IsUserInRole("networkServices")) Then
Return True
Else
Return False
End If
End Sub
.
- Prev by Date: Re: Hiding labels and textboxs in formview templates according to role
- Next by Date: Re: Stream pdf to browser
- Previous by thread: Re: Hiding labels and textboxs in formview templates according to role
- Next by thread: problem and i wana solution
- Index(es):
Relevant Pages
|