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

RadListBox Transfer Item Issue

0 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Visali
Top achievements
Rank 1
Visali asked on 11 Jun 2012, 11:01 AM
hi
I have 2 RadListBox 's to transfer the items.
In RadListBox1 I have the following values :-

Ex:

Category1
   Item1
   Item2
   Item3
Category2
   Itemtest1
   Itemtest2

When I select RadlistBox1 to move , it should be in the following format in RadlistBox2

Category1-Item1
Category2-Itemtest1

So i have created following code

.aspx :-
 <telerik:RadListBox ID="lstAot" runat="server" AutoPostBack="false" Width="120px" Height="200px" TransferToID="lstAotselected" AllowTransfer="true" TransferMode="Move"
               AutoPostBackOnTransfer="true" SelectionMode="Multiple" AllowDelete="false" AllowReorder="false" OnTransferring="lstAot_OnTransferring">
                    </telerik:RadListBox>


 <telerik:RadListBox ID="lstAotselected" runat="server" allowtransferondoubleclick="true" causesvalidation="false"
                    height="115px" selectionmode="Multiple" skin="Telerik" width="245px">
                    </telerik:RadListBox>




.aspx.cs

  protected void lstAot_OnTransferring(object sender, RadListBoxTransferringEventArgs e)
    {
        foreach (RadListBoxItem item in lstAot.Items)
        {
                if (item.Selected)
                {
                    if (item.Value != "-")
                    {
                      
                        RadListBoxItem listitem = new RadListBoxItem();
                        listitem.Text = item.Value.Trim() + "-" + item.Text;
                        listitem.Value = item.Value.Trim();
                        lstAotselected.Items.Add(listitem);

                      
                    }
                }
            


            lstAot.DataBind();
        }
    }


results showing in below:-
Category1-Item1
item1

But i need the below format:-
Category1-Item1

Please help me for the above scenario.



No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Visali
Top achievements
Rank 1
Share this question
or