Hi
I tried some code for your requirement
Check my code for it
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language ="javascript" >
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<asp:datalist id="DataList1" runat="server" repeatcolumns="5" xmlns:asp="#unknown">
RepeatDirection ="Horizontal" onitemcommand="DataList1_ItemCommand"
onitemdatabound="DataList1_ItemDataBound" >
<HeaderTemplate >
</HeaderTemplate>
<itemtemplate>
<table width="20" height="20">
<tr>
<td>
<asp:linkbutton id="LinkButton1" runat="server" commandname="book" commandargument="<%#Eval("vid") %>"><img src="Images/Winter.jpg" width="19" height="19" /></asp:linkbutton>
</td>
</tr>
</table>
</itemtemplate>
<footertemplate>
</footertemplate>
</asp:datalist>
</div>
</form>
</body>
</html>
And code behin file contains following code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MylocalDataClassesDataContext db = new MylocalDataClassesDataContext();
var g = from d in db.VideoTabs
select d;
DataList1.DataSource = g;
DataList1.DataBind();
}
}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "book")
{
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton rdblist = (LinkButton)e.Item.FindControl("LinkButton1");
rdblist.Text = "<img src="\"Images/Waterlilies.jpg\"" width="\"19\"" height="\"19\"" />";
}
}
Here you've to check the database values in databound event
I hope you can understood What I did.
All the Best