Sorry for posting kind of a repeated question. Due to my reputation, i couldn't post a question in the comments of Hidden Id With ComboBox Items?
How can i select an item from the ComboBox depending upon the HiddenID?
SQL Example : "Select displayValue from ComboList where hiddenValue = 10"
For the convenience, I'm pasting the code from the above link.
public class ComboBoxItem()
{
string displayValue;
string hiddenValue;
//Constructor
public ComboBoxItem (string d, string h)
{
displayValue = d;
hiddenValue = h;
}
//Accessor
public string HiddenValue
{
get
{
return hiddenValue;
}
}
//Override ToString method
public override string ToString()
{
return displayValue;
}
}
And then in your code:
//Add item to ComboBox:
ComboBox.Items.Add(new ComboBoxItem("DisplayValue", "HiddenValue");
//Get hidden value of selected item:
string hValue = ((ComboBoxItem)ComboBox.SelectedItem).HiddenValue;