How can I make only one if-else statement among all of these? I have these if-else statements that I am not able to refactor.  I have used them for doing validations on server-side using asp.net.

Would anyone please suggest ways to reduce these statements?  Here, validation fields and validation types are enum lists.

else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationFields.FO.ToString(), ValidationTypes.P.ToString()))
{
   BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
   args.IsValid = false;
}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationFields.FW.ToString(), ValidationTypes.P.ToString()))
{
   BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
   args.IsValid = false;
}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationFields.UF.ToString(), ValidationTypes.P.ToString()))
{
     BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
     args.IsValid = false;
}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationTypes.O.ToString(), ValidationTypes.P.ToString()))
{
      BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
      args.IsValid = false;
}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationTypes.W.ToString(), ValidationTypes.P.ToString()))
{
      BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
      args.IsValid = false;

}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationTypes.P.ToString(), ValidationTypes.C.ToString()))
{
      BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
      args.IsValid = false;

}
else if (CheckNextItem(ddlBr1Type.SelectedValue.ToString(), ddlBr2Type.SelectedValue.ToString(), ValidationTypes.C.ToString(), ValidationTypes.U.ToString()))
{
      BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
      args.IsValid = false;

}


This is method for Checknextitem:

 public static bool CheckNextItem(string Compareitem1, string comnpareitem2, string items1, string items2)
  {

        var listContains = Compareitem1 == items1 &amp;&amp; comnpareitem2 != items2;
        return listContains;

  }
If each ID1 can only have one valid corresponding ID2, then I would recommend using a  dictionary object to store the valid combinations, like this:

Dictionary&lt;string, string&gt; validIds = new Dictionary&lt;string,string&gt;();
validIds[ValidationFields.FO.ToString()] = ValidationTypes.P.ToString();
validIds[ValidationFields.FW.ToString()] = ValidationTypes.P.ToString();
validIds[ValidationFields.UF.ToString()] = ValidationTypes.P.ToString();
// ...


Then, you can check to see if the currently selected values are valid by simply comparing them to the valid combinations in the dictionary, like this:

if (validIds[ddlBr1Type.SelectedValue.ToString()] != ddlBr2Type.SelectedValue.ToString())
{
    BrkTypeValidator2.ErrorMessage = "'TOP0618 -Invalid combination of Bracket IDs'";
    args.IsValid = false;
}


By doing it that way, you only need the single if statement.  Another side benefit is that you can now store the list of valid combinations somewhere else, outside of your code, such as in a configuration file or a database.  Then you could load the data from that data source into the dictionary at run-time.