I have tried to add and delete items but to no avail. I noticed the posting regarding Ajax request is made with every add to syncronize the server-side collection of items but in my case I need it all dynamically done on the client side. I am trying to replace an asp.net listbox with an ig WebDropDown. Thanks in advance. Here is the markup for both:
<asp:ListBox ID="ListBoxAccounts" runat="server" SelectionMode="Multiple" >
<asp:ListItem Text="Accounts" Value="-1" />
</asp:ListBox>
<ig:WebDropDown ID="ListBoxAccounts2" runat="server" Width="200px" DropDownAnimationDuration="100" DisplayMode="DropDownList" EnableDropDownAsChild="False" EnableMultipleSelection="True">
</ig:WebDropDown>
Here is the function that updates the asp.net list but cannot add a single item to the ig control.
function ddlAcctGrpChng2(sender, args) {
if (sender.get_selectedItemIndex() < 0)
sender.set_selectedItemIndex(0);
var lbsa = $get('<%=ListBoxAccounts.ClientID %>');
var lbsa2 = $find('<%=ListBoxAccounts2.ClientID %>');
lbsa.options.length = 0;
var al = lazyLoad2(sender.get_items().getItem(sender.get_selectedItemIndex()).get_text());
for (var i= 0;i< al.length;i+= 2) {
var opt2 = document.createElement("OPTION");
opt2.text = al[i];
opt2.value = al[i + 1];
opt2.selected =
true;
lbsa.options.add(opt2);
}
var itms = lbsa2.get_items();
for (var i = itms.getLength() - 1; i >= 0; i--)
itms.remove(itms.getItem(i));
var itm = itms.createItem();
itm.set_text(
"hello");
itm.set_value(
"1");
itms.add(itm);
Hi Matt,
Currently this is not possible. We have it added in the list of new features/improvements with a high priority. I will update you when it gets done.
Thanks for your feedback,
Angel