It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

I need help in this code

I need help in this code

Postby ananabha on Mon Nov 16, 2009 5:28 pm

I have a java script code that highlights each row after it is selected by a checkbox
( i am using a control called gridview in asp.net )

i want the code to perform two things
1- highlight the row when it is selected ( when the checkbox status is checked ) .
2- cancel the highlighting when the checkbox is deselected again ( when the checkbox status is unchecked ) .

the code already makes the first thing successfully
my problem is in the second case ( i mean when the checkbox is unchecked ) the color (highlighting ) doesn't change .
here is the function
=======================================

function Check_Click(objRef)
{
//Get the Row based on checkbox
var row = objRef.parentNode.parentNode;

//Get the reference of GridView
var GridView = row.parentNode;

//Get all input elements in Gridview
var inputList = GridView.getElementsByTagName("input");

for (var i=0;i<inputList.length;i++)

{

//The First element is the Header Checkbox
var headerCheckBox = inputList[0];

//Based on all or none checkboxes
//are checked check/uncheck Header Checkbox
var checked = true;
if(inputList[i].type == "checkbox" && inputList[i] != headerCheckBox)
{
if(!inputList[i].checked)
{
row.style.backgroundColor = "#C2D69B";

checked = false;

break;

}
}
}
headerCheckBox.checked = checked;
}
====================================

please help me .. i need this code
thanks in advance
ananabha
 
Posts: 2
Joined: Mon Nov 16, 2009 5:06 pm

Re: I need help in this code

Postby ananabha on Tue Nov 17, 2009 10:44 pm

Please help me
i need to solve this problem
please help
ananabha
 
Posts: 2
Joined: Mon Nov 16, 2009 5:06 pm


Who is online

Users browsing this forum: No registered users and 1 guest