Reputation: 117
Hi Experts How to Select Full Row in Repeater Control in asp.net I Have Right the following code
function SetSelectedModuleIdRow(rowId, objRepeater) {
var rows = document.getElementById(objRepeater).getElementsByTagName("TR");
for (var j = 0; j < rows.length; j++) {
cells = rows[j].getElementsByTagName("TD");
for (var i = 0; i < cells.length; i++) {
cells[i].style.backgroundColor = '#ffffff';
}
}
var row = parseInt(rowId) + 1;
arrCol = rows[row].getElementsByTagName("td");
for (var j = 0; j < arrCol.length; j++) {
arrCol[j].style.background = '#808080 ';
}
}
on ItemDatabound call this function.
Upvotes: 0
Views: 7922
Reputation: 1
function Select(obj) {
obj.className = 'selected';
var tbl = document.getElementById("table1")
var firstRow = tbl.getElementsByTagName("TR")[0];
var oldRow = tbl.rows[firstRow.getElementsByTagName("input")[0].value];
if (oldRow != null) {
oldRow.className = '';
}
firstRow.getElementsByTagName("input")[0].value = obj.rowIndex;
}
In repeater's tr
you put this:
<tr style="cursor: pointer" onclick="Select(this);">
And in the <scipt>
tag, put:
.selected
{
background-color:blue;
}
Upvotes: 0