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

add RadListBoxItem

1 Answer 47 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 24 Dec 2012, 08:25 AM

Hi,

I want to add a RadListBoxItem into a RadListBox from javascript.
 
Can anybody help me to achieve this scenario ASAP?


Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Dec 2012, 08:43 AM
Hi,

Try the following code to achieve your scenario.
JS:
function AddNewItem()
{
           var lb = $find("<%= RadListBox1.ClientID %>");       
           var item = new Telerik.Web.UI.RadListBoxItem();
           item.set_text("New Item");
           lb.trackChanges();
           lb.get_items().add(item);
           item.select();
           lb.commitChanges();
  }

Thanks,
Princy.
Tags
ListBox
Asked by
Sigma
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or