IsNullorEmpty combobox.selectedvalue
-
29-10-2019 - |
Frage
I am trying to set a combobox.selectedValue to a string which works but when its nullorempty it errors out. I have tried the following code to no avail:
if (string.IsNullOrEmpty(docRelComboBox.SelectedValue.ToString()))
{
document = "other";
}
else
{
document = docRelComboBox.SelectedValue.ToString();
}
The combobox is databound but in theory it could be nullorempty in certain situations and I need to be able to pass the other value at those times. Any help would be great.
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow