我应该使用哪个属性或方法将 ToolTip 属性绑定到 ImageField 类?

发布于 2024-12-25 08:14:10 字数 525 浏览 3 评论 0原文

在绑定在 GridView 列内的图像控件中,我可以使用 DataAlternateTextField 属性设置 Alt 文本属性。

<asp:ImageField DataImageUrlField="Flag" 
     DataImageUrlFormatString="~/images/f/{0}.png"
     DataAlternateTextField="Description"  >
</asp:ImageField>

这会导致类似...

<img src="1.png" alt="Alt text"/>

我应该使用哪个属性或方法来绑定 ToolTip 属性?

<img src="1.png" alt="Alt text"  ToolTip="Title text" />

我希望网站的用户将鼠标悬停在图像上时能够读取标题属性。

In an image control that is bound within a GridView column i can set the Alt text property by using the DataAlternateTextField property.

<asp:ImageField DataImageUrlField="Flag" 
     DataImageUrlFormatString="~/images/f/{0}.png"
     DataAlternateTextField="Description"  >
</asp:ImageField>

which results in somathing like...

<img src="1.png" alt="Alt text"/>

Which property or method should i use to bind the ToolTip property?

<img src="1.png" alt="Alt text"  ToolTip="Title text" />

I would like the users of the website, on mouse hovering of the image, to be able to read the title property.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ぃ双果 2025-01-01 08:14:10

对于所有像我一样的新手,这是我所做的

             <asp:TemplateField HeaderText="Test" SortExpression="">
                 <ItemTemplate>
                 <asp:Image ID="Image1" runat="server" 
                    ImageUrl='<%# Eval("Flag", "~/images/f/{0}.png") %>' 
                    AlternateText='<%# Bind("Description") %>' 
                    ToolTip='<%# Bind("Description") %>' />
                 </ItemTemplate>
              </asp:TemplateField>

谢谢维罗妮卡

To all newbies out there just like me, here what i did

             <asp:TemplateField HeaderText="Test" SortExpression="">
                 <ItemTemplate>
                 <asp:Image ID="Image1" runat="server" 
                    ImageUrl='<%# Eval("Flag", "~/images/f/{0}.png") %>' 
                    AlternateText='<%# Bind("Description") %>' 
                    ToolTip='<%# Bind("Description") %>' />
                 </ItemTemplate>
              </asp:TemplateField>

Thanks Veronica

中性美 2025-01-01 08:14:10

您可以使用绑定表达式来设置 ImageField 的标题。 http://msdn.microsoft.com/en-us/library/ms178366.aspx

You can use binding expression to set the title of the ImageField. http://msdn.microsoft.com/en-us/library/ms178366.aspx

緦唸λ蓇 2025-01-01 08:14:10

我现在正在根据 Microsoft,ImageField 的备用文本属性也应该转换为工具提示。至少我刚刚链接的 msdn 页面上是这么说的。

I am playing with this issue now according to Microsoft, the alternate text property of an ImageField should translate into a tooltip as well. At least that's what it says on the msdn page i just linked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文