In HTML DOM, the selectedIndex property sets or returns the index of the selected option in a dropdown list. The index starts at 0.
Questions tagged [selectedindex]
354 questions
3
votes
7 answers
Specify a default selected item for HTML form drop-downs
Typically when you need to select an item by default, you do:
3
votes
2 answers
Swift 2.1- tabBarController!.selectedIndex return massive integer
I am needing to put the tabBarController!.selectedIndex number inside a constant.
I am expecting a number between 0 and 3 depending on what tab I choose, but instead I get numbers like 2147483647
Any ideas why this is?
The code is:
let selectedTab =…

jwknz
- 6,598
- 16
- 72
- 115
3
votes
2 answers
ASP.NET DropDownList / HTML select list default selection
For my ASP.NET page, in the code behind I load various items/options into a DropDownList but I do not set a default by assigning SelectedIndex. I notice for the postback SelectedIndex is set to 0, even if I never set focus to or changed the value in…

harrije
- 407
- 4
- 12
- 21
3
votes
2 answers
Get selected value of option with multiple dropdown menus using javascript
I have multiple features that have multiple options that need to be updated when an option is selected. I also need to pass a third piece of data through the attribute element.
.getElementById() works for a single dropdown menu, but how do I get it…

user27068
- 179
- 2
- 10
3
votes
3 answers
DropDownList SelectedIndex not working in FireFox after page refresh
I've got DropDownList in UpdatePanel as shown below:
…

jartur
- 43
- 1
- 5
3
votes
1 answer
ASP.NET Button OnClick not firing without setting UseSubmitBehavior="false"
My problem is in asp.net Button control and DropDownList.
I have a Button called ApplyButton and a DropDownList called FilterCombo.

Chamithra Thenuwara
- 399
- 6
- 19
3
votes
2 answers
ComboBox SelectedItem does not change after clearing the observable collection
I'm having an issue with a ComboBox which is bound to an ObservableCollection and I was wondering if anyone can point to what I am missing.
I have a ComboBox which is bound to a simple ObservableCollection. Also I bind the SelectedIndex in…

Izik Shmulewitz
- 125
- 1
- 6
3
votes
2 answers
Getting the selectedIndex of the currently selected tab from a viewcontroller
I currently have an iPhone application with a tabbar and multiple viewcontrollers. All the views are designed in Interface Builder. I'd like to be able to get the currently selected index of the tabbar from the viewcontroller, but for some reason…

mensch
- 4,411
- 3
- 28
- 49
2
votes
2 answers
WPF SelectedIndex set issue of TabControl
I have a TabControl with two items.
private void…

tree1891
- 25
- 2
- 8
2
votes
4 answers
asp .net dropdownlist selectedindex not working
I have the following piece of code:
DataRow CreateRow(DataTable dt, string name, string country)
{
DataRow dr = dt.NewRow();
dr["Name"] = name;
dr["Country"] = country;
return dr;
}
protected void…

Varun Sharma
- 2,591
- 8
- 45
- 63
2
votes
1 answer
Is it possible to listen for selectedIndex change?
I am looking for a way (or a workaround) to subscribe for selectedIndex changing (on

Shimon S
- 4,048
- 2
- 29
- 34
2
votes
3 answers
ListBox SelectedIndex is always -1
I have a Listbox with Button and Textblock as ItemTemplate. Button has an onClick event.
All i want is to get the index of the clicked item, but SelectedIndex property in my ListBox is always -1!
How can I get the index of the clicked item?

MCKool
- 23
- 2
2
votes
2 answers
Getting the SelectedIndex of a child node in a TreeView
I am currently working on a wpf project in C#.
I have a treeview created that has parent nodes with childen nodes inside of it.
I was wondering if there was a way to get the index of the child node the user clicked on. (Simmilar to ".SelectedIndex"…

Johnston
- 2,873
- 8
- 29
- 39
2
votes
3 answers
C# Selecting a CheckBoxList item(s) by matching against an Array of strings
I'm struggling to find a solution to my problem, I have spent a considerable amount of time trying alternative solutions to no avail. Any help or explanations would be greatly appreciated.
I have a SQL database which has a string field called…

Harry Nicholls
- 75
- 1
- 11
2
votes
1 answer
WPF Data Trigger not working - ComboBox selected index is not getting set to 0
I want to set the SelectedIndex of ComboBox to 0 when the SelectedItem it is bound to is null by using DataTrigger. But it is not working. Where am I going wrong?
The xaml is as follows:

Gurucharan Balakuntla Maheshku
- 2,399
- 9
- 43
- 76