change DataList
definition like below
<asp:DataList ID="DataList2" runat="server" BackColor="Gray" BorderColor="#666666"
BorderStyle="None" BorderWidth="2px" CellPadding="3"
CellSpacing="2" RepeatLayout="Flow" Font-Names="Verdana"
Font-Size="Small" GridLines="Both" RepeatColumns="3"
RepeatDirection="Horizontal"
Width="100%" ItemDataBound="DataList2_ItemDataBound">
then change ItemTemplate
like below
<ItemTemplate>
<asp:Literal runat="server" ID="ltrlLightBox"/>
<b>Employee Name:</b>
<asp:Label ID="lblCName" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
access the literal control
in ItemDatabound event
protected void DataList2_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Literal ltrlLightBox = (Literal)e.Item.FindControl("ltrlLightBox");
DataRow drow = (DataRow)e.Item.DataItem;
ltrlLightBox.Text = "<a data-lightbox=\"roadtrip\" href=\"PlayerImages/" + drow["Path"].ToString() + "\" > <img src=\"PlayerImages/" + drow["Path"].ToString() + "\" width=\"50%\" height=\"50%\" /></a><br />";
}
}