I am trying to verify if the SelectedItem of a RadComboBox is null using the following code:
if (String.IsNullOrWhiteSpace(RadComboBox1.SelectedItem.Text))
{
//Do something
}
However, when the SelectedItem IS null, this code throws a NullReferenceException... the very thing I was trying to check for.
I found this question which describes how to check if a ComboBox is null, but Telerik's RadComboBox does not have a "SelectedText" property.
How can rewrite this simple code to check if the RadComboBox has an item selected or not?