Sep 26, 2014, 6:01 PM
[CLOSED] Select the firt item in a ComboBox?
I have the following Combobox and I need the first item to be selected:
Isn't there a easy way to select the first item using the Index of the item????
X.ComboBox()
.ID("yearComboBox")
.Editable(false)
.Flex(1)
.FieldLabel("Year")
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
)
.Items(
items =>
{
for (int i = DateTime.Today.Year; i > DateTime.Today.Year - 10; i--)
{
var yearItem = new ListItem(i.ToString());
items.Add(yearItem);
}
}
)
I don't want to use .SelectedItems(new ListItem("2014"))
because obviously this is not going to work in the future.Isn't there a easy way to select the first item using the Index of the item????
Last edited by Daniil; Sep 27, 2014 at 7:55 AM.
Reason: Please use [CODE] tags, [CLOSED]