I have set of controls inside of a list view in which I want to be disabled until a certain checkbox is checked.
My current code looks like this:
However, with this code I get null reference exception when it tries to set the Enabled setting.
My current code looks like this:
protected
void
chckRSMCA_CheckedChanged(
object
sender, EventArgs e)
{
CheckBox checkboxRS = (CheckBox)sender;
RadTextBox Id = (RadTextBox)rlvListView.FindControl(
"txtRSFarmIdMCA"
);
RadTextBox Address = (RadTextBox)rlvListView.FindControl(
"txtRSSvrAddressMCA"
);
if
(checkboxRS.Checked)
{
Id.Enabled =
true
;
Address.Enabled =
true
;
}
else
{
Id.Enabled =
false
;
Address.Enabled =
false
;
}
}
However, with this code I get null reference exception when it tries to set the Enabled setting.