// same PreRender as above, but now for a CheckBoxList
protected void cblHalfEnabled_PreRender(object sender, EventArgs e)
{
CheckBoxList cbl = (CheckBoxList)sender;
// loop through all Controls that are of type CheckBox: that's actually only one.
foreach (Control checkbox in cbl.Controls)
{
if (checkbox is CheckBox)
(checkbox as CheckBox).InputAttributes.Add("disabled", "disabled");
}
}
|