transfer items from combobox to listbox

3 posts, 1 answers
  1. Anjali
    Anjali avatar
    101 posts
    Member since:
    Dec 2010

    Posted 24 Aug 2012 Link to this post

    Hi All,

    I want to transfer items from radcombox to radlistbox, I want to two radcomboxes and when the right arrows is clicked then items get added to the list box.

    How can I achieve this.

    any help will be apprecaited.
    Thanks.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Aug 2012 Link to this post

    Hi Anjali,

    One suggestion is that you can add one button in between RadComboBox and RadListBox and write the functionality of transfer on button click event. Following is the sample code that I tried to achieve your scenario.

    CSS:
    <style type="text/css">
      .btnCSS
       {
          background: url("WebResource.axd?d=Dcj3qOiclUvjzKRELru6Z1xI-utQCVtBIP2v9bSGM80pTcv6IJl6WfWjHaUHTII6tLMpjsJp6Xv2PXXDyIkPPK3vZtTpAqJrOQL4ygletz6ooeGEvSOwmjH1ZoNDoGWL7yvjlFauCTZQpaXM3jRjWbCBr2yfrZ8yz1ZWf7Fm7ec1&t=634745903440000000") no-repeat scroll 0 0 transparent;
          background-position: -200px -75px;
       }
    </style>

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server">
      <Items>
        <telerik:RadComboBoxItem Text="RadComboBoxItem11" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem12" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem13" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem14" />
      </Items>
    </telerik:RadComboBox>
    <telerik:RadComboBox ID="RadComboBox2" runat="server">
      <Items>
        <telerik:RadComboBoxItem Text="RadComboBoxItem21" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem22" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem23" />
        <telerik:RadComboBoxItem Text="RadComboBoxItem24" />
      </Items>
    </telerik:RadComboBox>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" CssClass="btnCSS" />
    <telerik:RadListBox ID="RadListBox1" runat="server">
    </telerik:RadListBox>

    C#:
    protected void Button1_Click(object sender, EventArgs e)
        {
            string s = RadComboBox1.SelectedItem.Text;
            string s1 = RadComboBox2.SelectedItem.Text;
            RadListBoxItem item = new RadListBoxItem(s);
            RadListBox1.Items.Add(item);
            RadListBoxItem item1 = new RadListBoxItem(s1);
            RadListBox1.Items.Add(item1);
        }

    Please elaborate your scenario if it doesn't helps.

    Regards,
    Princy.
  3. Anjali
    Anjali avatar
    101 posts
    Member since:
    Dec 2010

    Posted 30 Aug 2012 Link to this post

    Thanks Princy!!
Back to Top