【发布时间】:2016-08-29 00:57:03
【问题描述】:
对于令人费解的标题,我深表歉意。
我有一个DataList,如下所示:
<asp:DataList ID="DataListFloor" runat="server" RepeatColumns="5" >
<ItemTemplate>
<div style='width:199px;height:166px;background-color: <%# Eval("background") %>'>
<div style="width: 199px; height: 22px; overflow: hidden;">
<div style="box-sizing: border-box; width:97px; float:left;">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Name")%>'></asp:Label>
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>
要绑定到这个DataList 的数据表是:
Name background background_mouseOver
----------------------------------------
Joe Yellow Orange
Mary white Beige
Jane Red Maroon
Carl gray Darkgray
div 的background-color 已设置为background 列中的颜色。所以我知道该属性的 Eval 有效。
我的问题是:如何将MouseOver 上的div 的background-color 更改为datatable 列background_mouseOver 中的值。例如,对于显示 Joe 的数据列表项,背景颜色将为 Yellow。当我将光标移到该单元格上时,背景颜色将变为 Orange。
请不要使用 jquery。
谢谢。
【问题讨论】:
标签: javascript html css asp.net visual-studio-2010