You must Sign In to post a response.
  • Category: JavaScript

    Error: Unable to get value of the property 'checked': object is null or undefined

    Hi,

    We have an application with the below java script code which is giving the error, unable to get the value of the property check box, we need to change the below code in the format <%=Checkbox1.ClientID%> format. Please help to change the below code in that format,

    I have multiple lines of code like below, because of that I need to use predefined variable "crtlName"

    var ctrlName="CheckBox"

    if(document.getElementById(ctrlName + "1").checked)
    {
    document.getElementById(ctrlName + "Table1").style.display ='inline';
    }

    Thanks,
    Durga Rao
  • #769675
    As you have used server side asp.net control and you need to try with clientid when you access that control at client side. because all the relevant events are firing at server side and those will get allow to access with clientid only.

    you need to change the code as like below for all the cases

    document.getElementById('<%=Checkbox1.ClientID%>').checked

    or else

    change the controls to HTML control like below , so that your code works as is without change.

    <input type="checkbox" id="CheckBox1" value="checkbox1">

    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments