Questions tagged [selectedvalue]

368 questions
379
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
  • 327,095
  • 105
  • 629
  • 812
41
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
  • 413
  • 1
  • 4
  • 4
31
votes
8 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,318
  • 9
  • 36
  • 63
19
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
  • 206
  • 1
  • 2
  • 6
15
votes
5 answers

Asp.NET DropDownList SelectedItem.Value not changing

markup:
code: // clear vehicles list …
Bahamut
  • 1,821
  • 8
  • 28
  • 49
11
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,309
  • 3
  • 40
  • 80
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,702
  • 8
  • 43
  • 67
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
  • 176,854
  • 291
  • 683
  • 1,015
10
votes
4 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
  • 1,055
  • 124
  • 399
  • 759
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,210
  • 20
  • 74
  • 121
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
  • 19,157
  • 34
  • 91
  • 136
8
votes
2 answers

Select multiple values in a multiple select box with Jquery

So I have two multiple select boxes like this