I’m using the combobox component, it seem equivalent to the select html tag,but not have the value in combobox?
For example:
HTML select:
<select name="foo">
<option value="baa">xxx</option>
<option value="foo">yyy</option>
</select>
if the value selected is xxx the value returned is baa for me
it is possible do this with some component of C#?
I hope this is clear. Thanks in advance.
You can use the regular ComboBox control, but with a little tweak. Each item added in the ComboBox is an
objectand when rendering, it calls theToString()method.We can create a custom class to add as ComboBox item:
Now, you can create instance of the above class and add to the
ComboxBox.Itemscollection.And you can access the selected item which is the instance of the
CombBoxItemby castingcomboBox1.SelectedItemtoCombBoxItem