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
                results.Add(group.Name)
            Next
     
            rlb_MemberGroups.DataValueField = ????????
            rlb_MemberGroups.DataSource = results
            rlb_MemberGroups.DataBind()
        End If
     
        Label1.Visible = False
     
    End Sub

    Thanks as always.
  2. Ivana
    Admin
    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: http://www.telerik.com/help/aspnet-ajax/listbox-binding-to-array.html.

    I hope it will help.

    Regards,
    Ivana
    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top