Farshid
Farshid

Reputation: 5364

ASP.net gridview image button alternative text

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.

Upvotes: 2

Views: 5326

Answers (2)

silentSage1384
silentSage1384

Reputation: 31

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

Upvotes: 3

gbs
gbs

Reputation: 7276

Use TemplateField instead of ButtonField like below:

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

Upvotes: 2

Related Questions