Friday 29 February 2008

GridView Select Rows Code 2.0

Simple link to a good post about how to make a Grid View row selectable without having a button at the end of each row, you can just click on the row to fire the onSelectedIndexChanging Event.

http://www.geekzilla.co.uk/

Linked Post written by : Paul Marshall

Here is a minor imporvement I made to the code written by Paul Marshall that just makes it easier to control the styling applied onMouseOver of the grid. I used it to change it so the whol row is highlighted rather than just underlining the text.

In GridView_RowDataBound I changed this bit of code to reference the my css file.

e.Row.Attributes["onmouseover"] ="this.style.cursor='hand';this.className='gridRollOver';";
e.Row.Attributes["onmouseout"] = "this.className='';";



No comments: