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

transfer items from combobox to listbox

2 Answers 147 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Anjali
Top achievements
Rank 1
Anjali asked on 24 Aug 2012, 05:11 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 Aug 2012, 04:37 AM
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.
0
Anjali
Top achievements
Rank 1
answered on 30 Aug 2012, 03:59 PM
Thanks Princy!!
Tags
ComboBox
Asked by
Anjali
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Anjali
Top achievements
Rank 1
Share this question
or