سؤال

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.

هل كانت مفيدة؟

المحلول

Use TemplateField instead of ButtonField like below:

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

نصائح أخرى

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"  />
...
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top