ASP.net gridview 图像按钮替代文本

发布于 2024-10-10 01:10:58 字数 168 浏览 0 评论 0原文

图像按钮中有一个 AlternateText 属性,以便将鼠标悬停在图像按钮上时,替代文本可以阐明按钮的功能。 我想使用 ASP.net 标准 gridview 来执行此操作,并在鼠标停在我添加到 gridview 的按钮字段按钮上时显示文本。但这样的属性并不存在,我使用智能感知的搜索毫无结果。

There is a AlternateText property in image-buttons so that while hovering mouse on image buttons, alternate text could clarify the functionality of the button.
I want to do so with ASP.net standard gridview and show a text while mouse being stopped on buttonfield button that I've added to my gridview. But such a property does not exist and my searches using Intellisense reached nowhere.

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

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

发布评论

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

评论(2

天邊彩虹 2024-10-17 01:10:58

如果您在 ButtonType 为 Image 的 ButtonField 的 ButtonField 上指定 Text 属性,则文本将用作图像的替代文本。

<asp:GridView ID="grdRegistrations" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:ButtonField ButtonType="Image" ImageUrl="~/img/detail.gif" Text="View Registration"  />
...

If you specify the Text property on the ButtonField of a ButtonField that has a ButtonType of Image the text will be used as the Alternate Text for the image.

<asp:GridView ID="grdRegistrations" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:ButtonField ButtonType="Image" ImageUrl="~/img/detail.gif" Text="View Registration"  />
...
戏舞 2024-10-17 01:10:58

使用 TemplateField 而不是 ButtonField,如下所示:

<asp:TemplateField>
    <ItemTemplate>
       <asp:ImageButton ID="ImageButton1" runat="server" AlternateText="My Text" />
    </ItemTemplate>
</asp:TemplateField>

Use TemplateField instead of ButtonField like below:

<asp:TemplateField>
    <ItemTemplate>
       <asp:ImageButton ID="ImageButton1" runat="server" AlternateText="My Text" />
    </ItemTemplate>
</asp:TemplateField>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文