Geeks With Blogs
Greg Young Greg.ToString()

or anything for that matter.

 

I was just reading this post http://geekswithblogs.net/dlussier/archive/2005/12/14/63142.aspx

There are 2 major problems with the solution presented.

1) it requires a recompile to change the colors

2) this should really be in a style sheet

Thus I present ... the style sheet implementation just set the datagridrow to be the right class.


in your css
.DataGridRow
{
background-color: black;
border: 0px;
behavior: url(/styles/rollover.htc);
}


in a .htc file

<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="Hilite()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="Restore()" />

<SCRIPT LANGUAGE="JScript">

var normalColor;

function Hilite() {
normalColor = currentStyle.backgroundColor;
runtimeStyle.backgroundColor = "#FFFF66";
}

function Restore() {
runtimeStyle.backgroundColor = normalColor;
}

</SCRIPT>
</PUBLIC:COMPONENT>

Posted on Thursday, December 15, 2005 10:43 AM | Back to top


Comments on this post: Highlight DataGrid Row

# re: Highlight DataGrid Row
Requesting Gravatar...
This is a nice application of style sheet behaviors but be careful if you need to support multiple browers.
Left by Nick Harrison on Dec 15, 2005 11:02 AM

# re: Highlight DataGrid Row
Requesting Gravatar...
Nice code, but try it on a 1000 rows table. Result: very slow. Also it's not crossbrowser compatible.
Left by Wad on May 07, 2008 1:19 PM

Your comment:
 (will show your gravatar)


Copyright © Greg Young | Powered by: GeeksWithBlogs.net