This falls over on the first elseif. Basically I have a load of dropdowns and I'm trying to work out which filters to select based on if people have selected the dropdown items or not.
An unhandled exception of type 'System.NullReferenceException' occurred in
Based On
private void btnSearch_Click(object sender, EventArgs e)
{
if (ddCompany.SelectedItem.ToString() == null && ddStatus.SelectedItem.ToString() == null)
{
UpdateTicketsList("NO", "NO");
}
else if (ddCompany.SelectedItem.ToString() != null && ddStatus.SelectedItem.ToString() == null)
{
UpdateTicketsList(ddCompany.SelectedItem.ToString(), "NO");
}
else if (ddCompany.SelectedItem.ToString() == null && ddStatus.SelectedItem.ToString() != null)
{
UpdateTicketsList("NO", ddStatus.SelectedItem.ToString());
}
}