VB.Net Highlight GridView Row OnMouseOver in ASP.Net

Combination of JavaScript, CSS and VB.Net code provides the functionality to highlight the GridView Row onmouseover. You can define the alternate CSS classes for showing the rollover color effect on GridView Rows. First CSS class will change the Row color to show highlight effect onmouseover event of GridView row. Second CSS class will set back the original color of the GridView Row onmouseout event. In this Sample we have used JavaScript code to change the CSS class name of GridView Row Items dynamically by attaching the onmouseover and onmouseout events to each Row Item programmatically using VB.Net code.

JavaScript Events Used

1. OnMouseOver

2. OnMouseOut

 

VB.Net for each loop is also used here to loop over the each Row Item of GridView control.

 

See the sample below to understand the functionality:

 

CategoryIDCategory NameDescriptionSelect
1BeveragesSoft drinks, coffees, teas, beers, and alesSelect
2CondimentsSweet and savory sauces, relishes, spreads, and seasoningsSelect
3ConfectionsDesserts, candies, and sweet breadsSelect
4Dairy ProductsCheesesSelect
5Grains/CerealsBreads, crackers, pasta, and cerealSelect
6Meat/PoultryPrepared meatsSelect
7ProduceDried fruit and bean curdSelect
8SeafoodSeaweed and fishSelect
  • HIRE EzineASP.Net Developers