I have the following script that is called in a checkbox control in a datagrid (did a attributes.add in the onitemdatabound event to 'assign' it to the checkbox).
Here's the javascript:
function colorRow(e)
{
if (!e) e = window.event;
var srcEl = e.target || e.srcElement;
var curElement = srcEl;
while (curElement && !(curElement.tagName == "TR"))
{
// Keep going until we reach the parent table row
curElement = curElement.parentNode;
}
if (curElement != srcEl)
{
if (srcEl.checked)
{
// Modify your colors here for a selected object
curElement.style.backgroundColor = "#fff8bb";
}
else
{
// Modify your colors for a deselected object (read: Normal)
curElement.style.backgroundColor = "#EDF5FF";
}
}
}
Here's part of the itemdatabound:
Dim cb As CheckBox = CType(e.Item.FindControl("tbTimeCheck"), CheckBox)
cb.Attributes.Add("onClick", "javascript:colorRow(event)")
The checkbox works as intended. No problem. However, I have another linkbutton in the datagrid, that when clicked, ALWAYS sets the background color to a dark blue color. This color is what I has mistakenly inserted in the colorRow function at first, before I changed it. There is no reference in my form for this background color, anywhere!!!
Even if I comment out the itemdatabound code, the linkbutton STILL shows this dark blue color!! How could this be? Is it residing in memory or something?? I added new linkbutton to the datagrid and it does the same thing.
I even restored saved files from the day before, and STILL the dark blue color... Has anyone seen this before??
Thanks.
Here's the javascript:
function colorRow(e)
{
if (!e) e = window.event;
var srcEl = e.target || e.srcElement;
var curElement = srcEl;
while (curElement && !(curElement.tagName == "TR"))
{
// Keep going until we reach the parent table row
curElement = curElement.parentNode;
}
if (curElement != srcEl)
{
if (srcEl.checked)
{
// Modify your colors here for a selected object
curElement.style.backgroundColor = "#fff8bb";
}
else
{
// Modify your colors for a deselected object (read: Normal)
curElement.style.backgroundColor = "#EDF5FF";
}
}
}
Here's part of the itemdatabound:
Dim cb As CheckBox = CType(e.Item.FindControl("tbTimeCheck"), CheckBox)
cb.Attributes.Add("onClick", "javascript:colorRow(event)")
The checkbox works as intended. No problem. However, I have another linkbutton in the datagrid, that when clicked, ALWAYS sets the background color to a dark blue color. This color is what I has mistakenly inserted in the colorRow function at first, before I changed it. There is no reference in my form for this background color, anywhere!!!
Even if I comment out the itemdatabound code, the linkbutton STILL shows this dark blue color!! How could this be? Is it residing in memory or something?? I added new linkbutton to the datagrid and it does the same thing.
I even restored saved files from the day before, and STILL the dark blue color... Has anyone seen this before??
Thanks.