1. Right-click "gridview", select "attribute"> "Event", select the "rowdatabound" attribute under "data", and double-click it.
2. Add the following code to the "gridviewdomainrowdatabound" method:
If (E. Row. rowtype = datacontrolrowtype. datarow)
...{
// The effect of alternating colors when the mouse moves to each item
E. Row. Attributes. Add ("onmouseout", "This. style. backgroundcolor = 'white'; this. style. Color = '#003399 '");
E. Row. Attributes. Add ("onmouseover", "This. style. backgroundcolor = '# 6699ff'; this. style. Color = '#8c4510 '");
}
3. save all the files and run the command. When the mouse moves within the range of the "gridview" table, the background color of each row changes and the color of the text changes.
4. This subtotal is very practical and can be eye-catching to view the records being viewed.
5. The above information is from the blog of [chengking (zhengjian)]. Thank you!