User-707554951 posted
Hi mohamedramzy780,
From your description, you would bind data to image from url and show the path of image.
You could refer to the following code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#test").click(function () {
var bg = $(this).css('background-image');
bg = bg.replace('url(', '').replace(')', '').replace(/\"/gi, "");
alert(bg);
});
});
</script>
<asp:ListView ID="ListView1" DataSourceID="SqlDataSource1" runat="server">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblProducts">
<tr runat="server">
<th runat="server">Image</th>
<th runat="server">name</th>
<th runat="server">age</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<div id="test" style="width: 50px; height: 50px; background-image: url('<%#"../image/"+ Eval("Image") %>')">aaa</div>
</td>
<td>
<asp:Label ID="FirstNameLabel" runat="Server" Text='<%#Eval("name") %>' />
</td>
<td valign="top">
<asp:Label ID="LastNameLabel" runat="Server" Text='<%#Eval("age") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [User]"></asp:SqlDataSource>
Output:

Best regards
Cathy