document.getElementById is null or not an object

Apr 1 2010 3:30 AM
Hi Every one

i created dynamic radio button and i add OnClick event on that and i write java script for enable and  disable the button depending upon some status the event is firing from the radio button and i able to check the status when i try to enable or disable the button i am getting the error document.getelementById is null or not an object i will show you the code which is am using
 function RadioEvent(Status,Button)
{
// var Button1='<%=btnAccept.ClientID %>';
// aler(document.getElementById(Button1).Text);
if(Status=="Request Accepted")
{
document.getElementById(Button).Enabled = true;
// document.getElementById('btnAccept').disabled=true;
//document.getElementById(Button1).setAttribute('Enabled','true');

//document.getElementById(Button).disabled = true;
//alert(Status);
//document.getElementById('btnDecline').Enabled=false;
//document.getElementById('btnAccept').Enabled = true;
}
else
document.form1.btnDecline.Enable=true;
//document.getElementById(Button1).removeAttribute('Enabled');
//document.getElementById(btnDecline).disabled = false;

}

the above is my java script and i am calling event like this
 MyRadioButton.Attributes.Add("onclick", "RadioEvent('" + Status + "','btnDecline');");

please correct me where i am doing mistake

Answers (6)