ArrayList to ListBox DataValueField

2 posts, 0 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 14 Aug 2012 Link to this post

    I need some assistance as to how can I assign the DataValueField Value using the code below.
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        'Dim UserName As String = Request.QueryString("UserName")
        Dim UserName As String = "Test"
        lbl_UserName.Text = UserName
        If Not IsPostBack Then
            Dim results As New ArrayList()
            Dim context As New PrincipalContext(ContextType.Domain, "Fred_NT")
            Dim p As UserPrincipal = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, UserName)
            Dim groups = p.GetAuthorizationGroups()
            For Each group In groups
            rlb_MemberGroups.DataValueField = ????????
            rlb_MemberGroups.DataSource = results
        End If
        Label1.Visible = False
    End Sub

    Thanks as always.
  2. Ivana
    Ivana avatar
    657 posts

    Posted 15 Aug 2012 Link to this post

    Hello Alan,

    When binding the RadListBox to an ArrayList the value of the items should be the same as text assigned to the items. An example of binding to an ArrayList is shown in the following help article:

    I hope it will help.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top