August 02, 2004

Even though an ASP.net DataGrid column has a so-called ItemStyle-Width property, set it to zero has no effect on the actual display width. Some may say we could just set its visible property to false, if so we'll not be able to access that column from client side which is unacceptable for my situation.
My final solution is to leave the column as it is at the server side but set display style of all its cells to "none" after page loaded. This way, user won't see the column, but client javascript could use its value.

Move data between two tables:
function moveRow(fromTable, toTable, innerHTMLText){
var srcElement = window.event.srcElement;
if (srcElement == null) return;

var oldTr = srcElement.parentElement.parentElement.parentElement;

var newTr = toTable.insertRow();
for (var i=0; i var td = newTr.insertCell();
if (i==1) td.style.display="none"
td.innerHTML = oldTr.cells[i].innerHTML;
}

var tdOperation = newTr.cells[newTr.cells.length-1];
tdOperation.innerHTML = innerHTMLText;

if (isEvenRow(newTr.rowIndex)){
newTr.style.backgroundColor = "Gainsboro";
}
else{
newTr.style.backgroundColor = "#EEEEEE";
}

newTr.style.color = "black";

fromTable.deleteRow(oldTr.rowIndex);
}

No comments: