R
rn5a
I want to change the background color of a row in a DataList when the
mouse is moved over a row. This is how I tried but it doesn't change
the background color of a row in the DataList when the mouse is moved
over a row:
<script runat="server">
Sub CreateItem(ByVal obj As Object, ByVal ea As
DataListItemEventArgs)
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
ea.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='pink';")
End If
End Sub
</script>
<form runat="server">
<asp
ataList ID="dlUsers" OnItemCreated="CreateItem" runat="server">
<HeaderTemplate>
<table border="2">
<tr>
<th>Name</th>
<th>EMail</th>
<th>UserName</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="lavender">
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("EMail") %></td>
<td><%# Container.DataItem("UserName") %></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr bgcolor="lightyellow">
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("EMail") %></td>
<td><%# Container.DataItem("UserName") %></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp
ataList>
</form>
Can someone please guide me on how to change the background color of a
row in a DataList when the mouse is moved over a row in the DataList?
mouse is moved over a row. This is how I tried but it doesn't change
the background color of a row in the DataList when the mouse is moved
over a row:
<script runat="server">
Sub CreateItem(ByVal obj As Object, ByVal ea As
DataListItemEventArgs)
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
ea.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='pink';")
End If
End Sub
</script>
<form runat="server">
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
<HeaderTemplate>
<table border="2">
<tr>
<th>Name</th>
<th>EMail</th>
<th>UserName</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="lavender">
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("EMail") %></td>
<td><%# Container.DataItem("UserName") %></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr bgcolor="lightyellow">
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("EMail") %></td>
<td><%# Container.DataItem("UserName") %></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
</form>
Can someone please guide me on how to change the background color of a
row in a DataList when the mouse is moved over a row in the DataList?