Questions tagged [selectedvalue]
395 questions
409
votes
5 answers
Difference between SelectedItem, SelectedValue and SelectedValuePath
What is the difference betweeen the following:
SelectedItem
SelectedValue
SelectedValuePath
All these dependency properties are defined in Selector class. I often confuse SelectedItem with SelectedValue , and SelectedValue with SelectedValuePath.…

Nawaz
- 353,942
- 115
- 666
- 851
47
votes
7 answers
Getting selected value of a combobox
public class ComboboxItem {
public string Text { get; set; }
public string Value { get; set; }
public override string ToString() { return Text; }
}
private void comboBox1_SelectedIndexChanged(object…

maxy
- 473
- 1
- 4
- 4
33
votes
7 answers
What is the simplest way to get the selected text of a combo box containing only text entries?
My WPF ComboBox contains only text entries. The user will select one. What is the simplest way to get the text of the selected ComboBoxItem? Please answer in both C# and Visual Basic. Here is my ComboBox:
…

DeveloperDan
- 4,626
- 9
- 40
- 65
21
votes
8 answers
Html.DropDownList Selected Value Not Working (Using Constructor with IEnumerable)
I have an issue where the selected value is not working for the Html.DropDownList helper method. See below:
This is My Controller:
public ActionResult Edit(int id = 0)
{
NewsEvent item = GetItem(id);
ViewBag.NewsItemId = new…

Paul Peat
- 226
- 1
- 2
- 6
17
votes
5 answers
Asp.NET DropDownList SelectedItem.Value not changing
markup:
code:
// clear vehicles list
…

Bahamut
- 1,929
- 8
- 29
- 51
12
votes
7 answers
Dropdown list selected value not working
In my ASP.NET project. I have two dropdownlist and a checkbox. When the checkbox is checked, the selected value of DropDownList1 must be same as selcted value of the DropDownList2. But the DropDownList1.SelectedValue is not working.
Here is my…

user998405
- 1,329
- 5
- 41
- 84
12
votes
5 answers
Should I use a Winforms combobox's SelectedItem, SelectedText, or SelectedValue?
I want to pass a value in a combo box as a param to a SQL statement. The Winforms combobox gives me several options for retrieving the value, namely SelectedItem, SelectedText, and SelectedValue. Which one is best/safest to use in this scenario?

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
11
votes
2 answers
ASP:DropDownList in ItemTemplate: Why is SelectedValue attribute allowed?
This piece of code

recursive
- 83,943
- 34
- 151
- 241
10
votes
3 answers
ASP.Net DropDownList selected value
I have a feeling I'm missing something really obvious, I'm not able to capture the selected value of my DropDownList; the value renaubs the first item on the list. I have set the DropListList autopostback property to true. I have a…

Susan
- 1,822
- 8
- 47
- 69
10
votes
4 answers
How to make simple combobox with selected value in XAML?
What is the correct syntax to select a combobox item with value (not index) in pure XAML?
Doesn't work:
Colorado

Edward Tanguay
- 189,012
- 314
- 712
- 1,047
9
votes
2 answers
How to set the ToolTip of WPF ComboBox based on selected value?
I have a ComboBox in my WPF application. Using below code I can set the ToolTip as selected value:
ToolTip="{Binding Path=SelectedValue, RelativeSource={RelativeSource Self}}"
But if I need to set a separate value for ToolTip based on ComboBox…

Relativity
- 6,690
- 22
- 78
- 128
8
votes
5 answers
html select not show selected even after set selected
I have a country dropdown and I set the selected attribute to US. I can clearly see select="selected" into select OPTION having value US in firebug. But neither firefox or chrome shown US as selected.
I have code for populate & selected country as…

kuldeep.kamboj
- 2,566
- 3
- 26
- 63
8
votes
2 answers
SelectedValue of DropDownList in Repeater
How do I set the selected item of a dropDownList inside a repeater?
The repeater is bound to the repeaterData DataTable and the dropDownList is bound to dropDownList DataTable in the code behind. I need to set the SelectedValue property of the…

dmr
- 21,811
- 37
- 100
- 138
8
votes
1 answer
Can't clear ListBox selection using SelectedItem = null - MVVM
I have the following data template (and a corresponding view model, not shown):
ItemsSource is bound to a list of…

NielW
- 3,626
- 1
- 30
- 38
8
votes
2 answers
Select multiple values in a multiple select box with Jquery
So I have two multiple select boxes like this

0x56794E
- 20,883
- 13
- 42
- 58