This is a migrated thread and some comments may be shown as answers.

ArrayList to ListBox DataValueField

1 Answer 8 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 2
Allan asked on 14 Aug 2012, 05:18 PM

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.

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 15 Aug 2012, 11:43 AM
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.
Tags
ListBox
Asked by
Allan
Top achievements
Rank 2
Answers by
Ivana
Telerik team
Share this question
or