ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method)

Discussion in 'Software' started by msandlana, Apr 25, 2008.

  1. msandlana

    msandlana

    Joined:
    Apr 10, 2008
    Messages:
    1
    Location:
    South Africa, Cape Town
    Can anyone help me with this code below I downloaded and this line does not work coz I'm using ASP.NET 2.0 I'm still new on asp.net. Is there anyone who know the Array.IndexOf(Of String) method

    The Linq.Enumerable.Contains(Of String)(...) syntax will not compile if you are using ASP.NET version 2.0. The Contains(Of String) method is part of the LINQ library, which is new to ASP.NET 3.5. If you are still using ASP.NET version 2.0, use the Array.IndexOf(Of String) method instead




    Private Sub CheckRolesForSelectedUser()
    ' Determine what roles the selected user belongs to
    Dim selectedUserName As String = UserList.SelectedValue
    Dim selectedUsersRoles() As String = Roles.GetRolesForUser(selectedUserName)

    ' Loop through the Repeater's Items and check or uncheck the checkbox as needed
    For Each ri As RepeaterItem In UsersRoleList.Items
    ' Programmatically reference the CheckBox
    Dim RoleCheckBox As CheckBox = CType(ri.FindControl("RoleCheckBox"), CheckBox)
    ' See if RoleCheckBox.Text is in selectedUsersRoles
    If Linq.Enumerable.Contains(Of String)(selectedUsersRoles, RoleCheckBox.Text) Then
    RoleCheckBox.Checked = True
    Else
    RoleCheckBox.Checked = False
    End If Next End Sub
     
    msandlana, Apr 25, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. newasp.net
    Replies:
    1
    Views:
    1,615
    imransyed63
    Aug 21, 2008
  2. jerryantony
    Replies:
    0
    Views:
    1,788
    jerryantony
    Nov 4, 2009
  3. jeif_lee

    C need help on array of string

    jeif_lee, Dec 4, 2009, in forum: General Computer Support
    Replies:
    0
    Views:
    1,306
    jeif_lee
    Dec 4, 2009
  4. amrutha0303
    Replies:
    0
    Views:
    990
    amrutha0303
    Aug 3, 2010
  5. amrutha0303
    Replies:
    0
    Views:
    2,143
    amrutha0303
    Aug 3, 2010
Loading...

Share This Page