If the ‘Value’ or ‘Text’ is not Exist it throws the error. We can find that item is exist in that DropDownList or not.
Code:
ListItem Item1 = drpLst.Items.FindByValue(“value”); //or ListItem Item1 = drpLst.Items.FindByText(“text”); if (Item1 == null) |