Please refer below sample:
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style type="text/css">
.Item
{
height: 150px;
width: 180px;
margin: 5px;
}
.Item, .Item td, .Item td
{
border: 1px solid #ccc;
}
.Item .header
{
background-color: #F7F7F7 !important;
color: Black;
font-size: 10pt;
line-height: 200%;
}
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
<script type="text/javascript">
$(function () {
$(".table1").bind("mouseover", function () {
$(this).css("background-color", "red");
});
$(".table1").bind("mouseout", function () {
$(this).css("background-color", "transparent");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class="table1 Item" cellpadding="2" cellspacing="0">
<tr>
<td>
<b><u>
<%# Eval("Name")%></u></b>
</td>
</tr>
<tr>
<td class="body">
<b>Id: </b>
<%# Eval("Id") %><br />
<b>Country: </b>
<%# Eval("Country") %><br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
Namespace
using System.Data;
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id"), new DataColumn("Name"), new DataColumn("Country") });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
this.DataList1.DataSource = dt;
this.DataList1.DataBind();
}
}
Screenshot