I have a programming task that involves creating and disabling checkboxes in an ASP.NET website. The checkbox creation code looks something like this:
cBox = New CheckBox
cBox.ID = "Link" & lngUSN & "|" & objTableMapping.DatasetName & "|" & CStr(objDRInput("URNs")) & "|" & intLinkCount & "|" & objTableMapping.Reference
cBox.InputAttributes.Add("class", "Link" & lngUSN & "|" & objTableMapping.DatasetName & "|" & CStr(objDRInput("URNs"))) '& "|" & intLinkCount)
cBox.Checked = False
cBox.Enabled = False
Once the page is loaded via AJAX, I need to enable these checkboxes using JavaScript:
window.onload = EnableLinkAndUnLinkCheckboxes;
function EnableLinkAndUnLinkCheckboxes()
{
//Go through all of the checkboxes on the webpage and ensure they are enabled
var frm = document.forms[0];
for (i = 0; i < frm.elements.length; i++) {
if (frm.elements[i].type == "checkbox") {
alert('got here')
frm.elements[i].disabled = false;
}
}
}
Despite reaching the code to enable the checkboxes ('Got here' alert appearing), they remain disabled. What could be causing this issue?