recuperate id item from combobox

  1. #1

    recuperate id item from combobox

    hi,

    the problem i have is concerning id of listitem, in my gridpanel, i have a combobox list wich content list of data, i have created like this :

            ComboBox cb = new ComboBox();
    
            LoadedList<MVarietyGroup> liste = MVarietyGroup.LoadBySpecie(_planSeedNeed.ProductionPlan.Specie);
    
            Ext.Net.ListItem listItem = new Ext.Net.ListItem();
            foreach (MVarietyGroup groupe in liste)
            {
                //cb.Items.Add(new Ext.Net.ListItem(groupe.Id, groupe.Name));  // want to use something like this, to have the id and the name (value)
                cb.Items.Add(new Ext.Net.ListItem(groupe.Name, groupe.Name));
            }
    i want to recuperate the item id to send it for saving, the problem is that in my "MVarietyGroup" i don't have id value, so i just want to know how can i proceed to obtain it from the listbox.

    thanks,
  2. #2
  3. #3
    thanks for your reply,

    the problem is that in my "MVarietyGroup" i don't have id value so i can't do something like this,
  4. #4
    If you don't have id then text will be as value. In this case you don't need any additioanl actions
    May be i misunderstood you
    Please post simple test sample demonstrates the issue
  5. #5
    it will be difficult to post a sample, i'll detail the problem,

    in my grid it's okey i retrieve my data (in all cells) one of this cell is an comboBox, when i want to edit and save changes , i had an error (because i have to use something like this : cb.Items.Add(new Ext.Net.ListItem(groupe.id, groupe.Name)) not this cb.Items.Add(new Ext.Net.ListItem(groupe.Name, groupe.Name)); ) because the value never change (the sting value) so, what i want its to pass id value to send new value of combobox.

    i fill my combobox with string, string , i want to use ("selected by id", string)
  6. #6
    Sorry, but i don't understand the problem. It would be best if you can provide a sample

Similar Threads

  1. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  2. combobox item selecting bug ! please help
    By relativ in forum 1.x Help
    Replies: 0
    Last Post: Nov 24, 2009, 4:31 AM
  3. ComboBox and New item
    By sfvaleriano in forum 1.x Help
    Replies: 5
    Last Post: Jul 10, 2009, 7:50 AM
  4. Get Combobox Selected item
    By yarlenvas in forum 1.x Help
    Replies: 3
    Last Post: Mar 08, 2009, 2:04 PM
  5. ComboBox - Add Default Item
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Feb 03, 2009, 3:26 PM

Tags for this Thread

Posting Permissions