Просто выполните простое условие if
if this.checkbox.checked && this.mydropdown.selectedindex=-1
//code / alert that warns the user you must make a selection
Возможно, вы можете использовать оператор ?:
:
bool b = ((myCheck.Checked && myDropDown.SelectedIndex==-1) ? true : false);
if(b) {
//stop submit of form as no selection was made
}
Или сделать код коротким и простым:
bool b = this.CheckBox1.Checked && this.DropDownList1.SelectedIndex == -1;
//when the checkbox is not check Response.Write(b); prints false
//when the checkbox IS checked and no item is selected, Response.Write(b); prints true