Hiding labels and textboxs in formview templates according to role

Discussion in 'ASP .Net' started by Guest, May 12, 2007.

  1. Guest

    Guest Guest

    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:

    Protected Sub passPhrase_Init(ByVal sender As Object, ByVal e As
    System.EventArgs)
    If (Roles.IsUserInRole("networkServices")) Then
    FormView1.UniqueID.passphrase.visible = True

    Else
    FormView1.ItemTemplate.itemtemplate.passphrase.visible = False
    End If
    End Sub

    Thank you for your time.

    Ann
     
    Guest, May 12, 2007
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.