I've got this code to prevent two opposite radio buttoms from both being checked:
RadioButton rbUSCitizenOrPermResY = null;
RadioButton rbUSCitizenOrPermResN = null;
. . .
rbUSCitizenOrPermResY = new RadioButton
{
CssClass = "finaff-webform-field-input"
}; // doesn't allow assignment to CheckedChanged above
rbUSCitizenOrPermResY.CheckedChanged += new EventHandler(rbUSCitizenOrPermResY_Changed);
. . .
private void rbUSCitizenOrPermResY_Changed(object sender, EventArgs e)
{
if (rbUSCitizenOrPermResN.Checked)
{
rbUSCitizenOrPermResN.Checked = false;
}
}
So, if the "Yes" radio button is checked, it unchecks the "No" radio button if the "No" radio button is checked.
Supposedly.
In actuality, this event handler is entered, but not when the radio button is clicked. Rather, it fires later, after I click the "Save" button. Is this an asynchronous event handler, that just wakes up whenever it feels like it? If so, how can I get it to "straighten up and fly right"/"shape up or ship out"?