[CLOSED] V2.0 ComboBox SelectedItem

  1. #1

    [CLOSED] V2.0 ComboBox SelectedItem

    Hi, it's possible select the first item ina combobox in c#?

    I don't know the value of the items and need to select the first item (index = 0) in the combo.

    ComboBox.SelectedItem.Value not work why the SelectedItem is null,
    SelectedIndex not exist...

    I do not know how to do

    Thanks
    Aurelio
    Last edited by Daniil; Apr 02, 2012 at 1:28 PM. Reason: [CLOSED]
  2. #2
    Hi,

    This way:

    Example
    <ext:ComboBox runat="server">
        ...
        <SelectedItems>
            <ext:ListItem Index="0" />
        </SelectedItems>
    </ext:ComboBox>
  3. #3
    HI, Daniil thanks, here it client side, but server side ?

    I can not do it server-side..
    I tested something similar, but I can not..

    ComboBoxNazioni.SelectedItems.Add(new ListItem("","",0));
    but this obviously puts a new item


    Thanks
    Aurelio
    Last edited by Daniil; Apr 02, 2012 at 11:08 AM. Reason: Please use [CODE] tags
  4. #4
    Please use:
    ComboBox1.SelectedItems.Add(new Ext.Net.ListItem { Index = 0 });
  5. #5
    Hi, Daniil

    many thanks it works ok..

    If someone has the same problem, remember to add the line below the command to update the combo, otherwise the item will not be displayed

    ComboBoxNazioni.SelectedItems.Add(new ListItem { Index = 0 });
                    ComboBoxNazioni.UpdateSelectedItems();
    Thanks
    Aurelio
  6. #6
    Yes, calling the UpdateSelectedItems is required the change to be affected during DirectEvent/DirectMethod.

Similar Threads

  1. [CLOSED] Combobox SelectedItem
    By Sevilay Tanış in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 13, 2012, 2:02 PM
  2. ComboBox and selectedItem.value
    By cwolcott in forum 1.x Help
    Replies: 3
    Last Post: Feb 01, 2012, 7:48 AM
  3. Replies: 4
    Last Post: Nov 30, 2011, 5:25 AM
  4. [CLOSED] [1.0] ComboBox.SelectedItem.Value
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 15, 2011, 11:21 PM
  5. Replies: 4
    Last Post: Feb 02, 2010, 4:08 PM

Posting Permissions