Populate combobox from DirectEvent (without using store)

Page 1 of 2 12 LastLast
  1. #1

    Populate combobox from DirectEvent (without using store)

    Hi,

    I was playing with version 1.0. First of all congratulations. Absolutely great work!

    i was expecting that populating a combobox from a directmethod (ajax) without using a store would be possible in this new version. I guess new methods like addItem, insertItem are for that use. But how can we delete all items first? I am trying to implement something like:

    Combobox1.Items.Clear(); // Probably this is not the method I need  // items is some List<string> foreach (string item in items) Combobox1.AddItem(item, item);
  2. #2

    RE: Populate combobox from DirectEvent (without using store)

    Hi,

    At this moment you can use the following code
    ComboBox1.AddScript("{0}.store.removeAll();", ComboBox1.ClientID);

    Don't confuse with 'store' word in the js code, even if you don't use a store the toolkit automatically creates client side store
  3. #3

    RE: Populate combobox from DirectEvent (without using store)

    Hi Vladimir,

    Thanks for quick response. Unfortunately it didn't work. Everything goes on as if I didn't put that line. No Javascript error though.


    Onur
  4. #4

    RE: Populate combobox from DirectEvent (without using store)

    okutlubay (6/24/2010) Hi Vladimir,

    Thanks for quick response. Unfortunately it didn't work. Everything goes on as if I didn't put that line. No Javascript error though.


    Onur
    I just tested the .AddScript option presented by Vladimir and it appears to work as expected for me. All items in the ComboBox/Store were removed.


    Geoffrey McGill
    Founder
  5. #5

    RE: Populate combobox from DirectEvent (without using store)

    You are putting this in a DirectMethod, right?

    I am trying to make it work inside an Ajax callback method.


    Onur.
  6. #6

    RE: Populate combobox from DirectEvent (without using store)

    Hi Onur,

    It would be best if you could post a code sample. Tough to say where the issue is without seeing some code.


    Geoffrey McGill
    Founder
  7. #7

    RE: Populate combobox from DirectEvent (without using store)

    OK! You are right. It works.
    I figured it our and was my bad. Sorry about it. Thanks y'all.



    By the way Vladimir told that 'at this point you can use....';
    should we expect a different (more c#'ish) solution to this?


    Onur.
  8. #8

    RE: Populate combobox from DirectEvent (without using store)

    Hi,

    Yes, I think we will add RemoveAll method to the combo which will generate that script
  9. #9

    RE: Populate combobox from DirectEvent (without using store)

    I see.


    But will it be using some other logic or just do the same thing using something like an extension...


    public static void ClearItems(this ComboBox control)
    {
    control.AddScript("{0}.store.removeAll();", control.ClientID);
    }
  10. #10

    RE: Populate combobox from DirectEvent (without using store)

    Hi,

    We're discussing a few potential revisions to the ComboBox + Store API. No decisions yet, but your Extension Method should work perfectly.


    Geoffrey McGill
    Founder
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] combobox populate
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 17, 2011, 9:08 AM
  2. Populate HTML select with Store
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 06, 2011, 3:36 PM
  3. [CLOSED] Multiselect will not populate from directevent
    By HOWARDJ in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Jun 29, 2011, 1:07 AM
  4. Replies: 0
    Last Post: Jan 04, 2011, 8:25 PM
  5. Replies: 2
    Last Post: Jan 02, 2011, 3:06 PM

Posting Permissions