开发者

ASP.net gridview image button alternative text

There is a AlternateText property in image-buttons so that wh开发者_如何学JAVAile 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.


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"  />
...


Use TemplateField instead of ButtonField like below:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜