RadListBox removing items after adding new item

2 posts, 0 answers
  1. Saquib
    Saquib avatar
    18 posts
    Member since:
    Aug 2011

    Posted 27 Apr 2013 Link to this post

    Hello,

    I have two RadListBoxes and a button in my page, my requirement is after clicking the button the selected items in RadListBox1 should move to RadListBox2.

    <telerik:RadListBox ID="RadListBox1" Width="200px" Height="300px"
         SelectionMode="Multiple" runat="server"></telerik:RadListBox>
    <telerik:RadListBox ID="RadListBox2" Width="300px" Height="300px" runat="server">
         </telerik:RadListBox>

    void button1_Click(object sender, EventArgs e)
    {
      foreach (RadListBoxItem selectedItem in RadListBox1.SelectedItems)
      {
         RadListBox2.Items.Add(
    new RadListBoxItem(selectedItem.Text));
      }
    }

    My problem is every time I click the button its removing already present item in RadListBox2 and adding the the currently selected item of RadListBox1. I want it to append the item to the already existing items of RadListBox2.

    Can anyone help me here please.

    Thanks,
    Saquib
  2. Saquib
    Saquib avatar
    18 posts
    Member since:
    Aug 2011

    Posted 28 Apr 2013 Link to this post

    Never mind on this one, I had the view state of the page set to false. For my anger, false is the default value for view state on page level in Sitefinity (for those who know Sitefinity).


    -Saquib 
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top