I have two drop down lists. I need a selection made in the second one if there is a selection in the first one.
if((ddl1.SelectedIndex > -1 ) != (ddl2.SelectedIndex > -1))
{
this.lblError.Visible = true;
}
So basically if the there is a selection in the first one but not the second one then error.
Would it be the drop down it’s self??
<asp:DropDownList ID="ddlRate1" runat="server">
<asp:ListItem Value="">(Select)</asp:ListItem>
<asp:ListItem>Initial</asp:ListItem>
<asp:ListItem>Moderate</asp:ListItem>
</asp:DropDownList>
UPDATED from your comments , UPDATED AGAIN..
this is why I originally wrote it with 2 if statements,
Then assuming you have code like this throughout your form , at the end you could do
OR..
Try this for trouble shooting – before the if statement