不透過RowDataBound 顯示滑鼠移動過Row變色...
正常大家使用的方式是透過RowDataBound中設定樣式
想試試看透過CSS Selector 來做到這個功能
以下是程式碼
<style type="text/css">
#gv_Display tbody tr:not(:first-of-type):hover ,#gv_Display tbody tr:not(:last-of-type):hover
{
background-color:orange;
color:white;
}
</style>
<asp:GridView ID="gv_Display " runat="server" Width="100%" GridLines="Both"
PageSize="10" AllowPaging="True" OnPageIndexChanging="gv_emp_PageIndexChanging" >
<Columns>
.....
</Columns>
...
</asp:GridView>
#gv_Display tbody tr:not(:first-of-type):hover
GridView 之網頁原始碼為Table > Tbody > Tr > Td
第一個 Tr 為表頭 排除在外,不做變色功能
#gv_Display tbody tr:not(:last-of-type):hover
最後一個 Tr 為頁碼 排除在外,不做變色功能