我有一个数据列表,其中图像从数据库动态绑定。 这个名字也来了,但是它分开显示,意味着在图像之上 我的要求是在图像上显示它。 鼠标悬停时,如何在图像上绑定名称。 请帮忙
提前致谢... !!!
<div class="marquee" id="mycrawler2">
<asp:DataList ID="FetchPhotos" RepeatDirection="Horizontal" runat="server">
<ItemTemplate>
<table cellpadding="0" cellspacing="0" align="center"><tr><td ><a href="MemberProfileDisplay.aspx?MemberId=<%#DataBinder.Eval(Container.DataItem ,"MemberId") %>" target="_blank" class="edit" "><img src="images/profilephotos/small/<%# Eval("SmallProfilePhoto")%>" width="185" height="240"/></a></td> </tr></table>
<asp:label ID="lbltitle" runat="server" Visible="true" Text='<%# Bind("FirstName") %>'></asp:label>
</ItemTemplate></asp:DataList></div>
背后的代码
FetchPhotos.DataSource = Photos;
FetchPhotos.DataBind();
在这段代码中,我将名称和图像绑定到数据列表。 我的要求是将其显示在图像上。
答案 0 :(得分:0)
你可以尝试更换
img src='images/profilephotos/small/<%# Eval("SmallProfilePhoto")%>' width="185" height="240"
与
asp:Image ID="imgSth" runat="server" ImageUrl="images/profilephotos/small/<%# Eval("SmallProfilePhoto")%>" ToolTip='<%# Eval("FirstName") %>'
width="185" height="240"
希望有所帮助
答案 1 :(得分:0)
这是一个非常直率的例子:
<html>
<body>
<table>
<tr>
<td>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAfCAYAAABTRBvBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj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Ak2AbtnQGVSQO0HHxClRNDYUoOq2a6gatPKu8gQ5e/OcKBY93Io3dk7EwtkzUHl7D/6+zwsvlfjt1afIB4NAvLAKSIuXup7iqzrPnoPlJ+sQp18XRWc7LfSf6SQ+Flaua6P8TGDarBhc1Pxk+lSu5OEuC9fd0IvyGTGaXCBBk0goJeTn91POUjkUqYxSxOY/GMDiZe2YVBFDJnWatUddOPihG/dUhfGtO0NEf53PGe60MOsGSqkZfSibHKe+wUBzowNfr4hTr0E9BnWYlXNCuOWOMJFRQ+MpF45RSc3yaXhwZRCTpsao8SPELlw+VWFfja93tJe3rO/PydV5nnd3KNRGG1yMWEcY7SVVJhqynIxGqAeg1phFMhxSeNqwqGVk6ZTbZjJ16KPYLN6lBlsV3oHm0V6lNyQRewQCVCe7bC8iUSoJ1GrrxDpiFLHOR9XE7THpXCZABN5w2RQBQQqQ023QGg0quTKfP5vWK1DiM6aywI7SXUZSAmKwejDnmcMs0kwDGP1Na0gjuQ6wfLTIIebUcMG1BtSUi9ew+8ldZbJ956FJCHzhrDyzMUl7GBrProtkzzTEoR0o23AxO0Q23sGy/Q/TE8bmVN9ZyqmO5BPqzPhQe8EXcPYGG0OTD9cZwxDP6kvO3aIzAMSzQB+0/UVnTA6iNOL62DpYKl5Rr+r+3172XJHvLEd7ZTjW+yONEcdq8Ktg01jvjzRGvJroPf46/zIB4RmHAR5WPlvHwUDkfwIMAAmfBvpvOhveAAAAAElFTkSuQmCC"
onmouseover="document.getElementById('1.png').style.visibility ='visible';"
onmouseout="document.getElementById('1.png').style.visibility ='hidden';"
/>
<a id="1.png" href="user1" style="visibility: hidden; position: relative; right: 50%;">User #1</a></td>
</tr>
</table>
</body>
</html>