View Full Version : Can anyone help me to solve the problem

03-11-2009, 05:25 AM
function OnChange_Chk(currCheckBox){
var selectedColor = 'Lavender';
var grid = document.getElementById("<%= grdStatusMaster.ClientID %>");
var Cell;
//Change this to fit your needs; pushButtonColumnIndex start at 0.
var pushButtonColumnIndex = 4;
var currRow = currCheckBox.parentElement.parentElement;
var currPushButton = currRow.cells[pushButtonColumnIndex].childNodes[0];

currRow.oldBackgroundColor = currRow.style.backgroundColor;

currPushButton.style.display = "block";
if (grid.rows.length > 0)
//loop starts from 1. rows[0] points to the header.
for (i=1; i<grid.rows.length; i++)
//get the reference of first column
cell = grid.rows[i].cells[4];

//loop according to the number of childNodes in the cell
for (j=0; j<cell.childNodes.length; j++)
//if childNode type is CheckBox
if (cell.childNodes[j].type =="button")
//assign the status of the Select All checkbox to the cell checkbox within the grid
cell.childNodes[j].style.display = "none";

currRow.style.backgroundColor= currRow.oldBackgroundColor;



function uncheckOthers(id)

var elm = document.getElementsByTagName('input');
for(var i = 0; i < elm.length; i++)
if(elm.item(i).id.substring(id.id.lastIndexOf('_')) == id.id.substring(id.id.lastIndexOf('_')))
if( elm.item(i).type == "checkbox" && elm.item(i)!=id){
elm.item(i).checked = false;



The code above allowed me to check only one checkbox in gridview and also set the style display of button into none if the checkbox unchecked.

I'm facing a problem. How can I make others button in gridview display in none except checkbox checked on that row.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum