Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
660
is there a way to create, add, and delete WebDropDown items on the client w/o postback?
posted

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);

}

 

 

Parents
No Data
Reply
  • 24671
    Verified Answer
    posted

    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 

Children
No Data