Radlistbox items inserted when allow duplicates set to False

2 posts, 0 answers
  1. Ingrid Williams
    Ingrid Williams avatar
    2 posts
    Member since:
    Apr 2010

    Posted 28 Jul 2011 Link to this post

    I am trying to display the items inserted into the destination listbox when multiple items are selected from the source but the items inserted is only the ones that are not duplicates since allow dupliates is set to false.  Below is my code.  However,  I am getting the items selected.  How do I get only the items that were actully inserted since it is not adding the duplicates.


    Sub rlDestinationGroup_Inserted(sender As Object, e As Telerik.Web.UI.RadListBoxEventArgs) Handles rlDestinationGroup.Inserted

      'gets the selected employee name

      Dim empName As String = rdCBEmpList.SelectedItem.Text

       lblMsg.Text = empName & " was added to the following group(s): "

     ' returns the list of items selected from the Source List

      For Each item As RadListBoxItem In rlGroupListSource.SelectedItems

     lblMsg.Visible = True

     lblMsg.Text += item.Text & ", "


     End Sub

    Your assistance is appreciated.


  2. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 03 Aug 2011 Link to this post

    Hello Ingrid Williams,

    I suggest that you hook to the Trasnferring event and use the following code there:

    Private Sub ListBox1_Transferring(sender As Object, e As RadListBoxTransferringEventArgs)
        Dim resultItems = e.Items.Where(Function(item) e.DestinationListBox.FindItemByText(item.Text) Is Nothing)
    End Sub

    the resultItems are the items which will be actually inserted (no duplicates).

    Kind regards,
    Genady Sergeev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top