Repeater鼠标选择变色,换行变色

<table>
<tr>
<td>用户编号</td>
</tr>
<asp:Repeater ID="rptUser" runat="server">
<ItemTemplate>
<tr style='background-color:<%#(Container.ItemIndex%2==0)?"red":"green"%>'>
<td><%#Eval("UID")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>

改变样式的话

                                <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<tr class='<%#(Container.ItemIndex%2==0)?"RowStyle":"AlternatingRowStyle"%>' onmouseover="currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6dbcfd',this.style.fontWeight='';"
onmouseout="this.style.backgroundColor=currentcolor,this.style.fontWeight='';">


 

原文地址:https://www.cnblogs.com/cuihongyu3503319/p/2397964.html