iterating through GridView and trying to figure out how to check if the check box controlled is enabled or not ??

How can I check if my check box control is enabled or not? I have tried the following code check :
if(inputList[i].disabled) {  }

But it does not work, because there is not a "disabled" property for my check box control.

The GridView was created dynamically in asp.net but ultimately I need to be able to set the values using Java script. All the code below works great except I don't know how to check if the checkbox is enabled or not? My goal is to check the checkbox if it is indeed disabled.

function UncheckAll(objectRef)
{

  var row = objectRef.parentNode.parentNode;
  var GridView = row.parentNode;
  var inputList = GridView.getElementByTagName("input");
  

 for(var i = 0; i < inputList.length; i++)
  {
     if(inputList[i].type == "checkbox")
	{
          if(inputList[i].disabled) // .disabled is not a property, so how can I check if it is enabled or not?
          {

          }
	  
	}


  }


}

Open in new window

LVL 2
brgdotnetcontractorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leonidas DosasCommented:
The checkbox element has an attr named "checked" So try with this change your  code.
function UncheckAll(objectRef)
{

  var row = objectRef.parentNode.parentNode;
  var GridView = row.parentNode;
  var inputList = GridView.getElementByTagName("input");
  

 for(var i = 0; i < inputList.length; i++)
  {
     if(inputList[i].type == "checkbox")
	{
//I changed the disabled property with the checked property
          if(inputList[i].checked===false) // .disabled is not a property, so how can I check if it is enabled or not?
          {

          }
	  
	}

Open in new window


PS
If it not working the above then set manual the attr checked in checkbox element and then retry to tun the code
0
brgdotnetcontractorAuthor Commented:
I know how to check if the check box is checked, just like you showed above however that  code isn't helpful because I need to be able to tell if the check box is enabled or disabled? I have several check boxes that are checked, but they are also disabled. So again I need to know how to check if they are enabled or disabled.
0
Leonidas DosasCommented:
function UncheckAll(objectRef)
{

  var row = objectRef.parentNode.parentNode;
  var GridView = row.parentNode;
  var inputList = GridView.getElementByTagName("input");
  

 for(var i = 0; i < inputList.length; i++)
  {
     if(inputList[i].type == "checkbox")
	{
          if(inputList[i].disabled===true) // .disabled is not a property, so how can I check if it is enabled or not?
          {
           
          }
	  
	}


  }


}

Open in new window


The dissabled attr takes a boolean value.So you must check is it false or true
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brgdotnetcontractorAuthor Commented:
Thank you so much, great help !!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.