Firze
Firze

Reputation: 4049

How can I change gridview delete button name?

How can I change the text on the delete "button"? For example if I wanted to have "ban user" there.

Delete buttons

Upvotes: 2

Views: 5858

Answers (2)

Blachshma
Blachshma

Reputation: 17395

Use the DeleteText attribute to set the name of the command

<Columns>
   <asp:CommandField ShowDeleteButton="True" DeleteText="Ban User"/>

If it's a TemplateField you can do it like this:

<asp:TemplateField ShowHeader="False">
    <ItemTemplate>
        <asp:LinkButton ID="LinkButton1" runat="server" 
                         CommandName="Delete" Text="Ban User"/>
     </ItemTemplate>
</asp:TemplateField>

Upvotes: 5

Kaf
Kaf

Reputation: 33839

On your markup page

If it is a CommandField, DeleteText="REMOVE"

<asp:CommandField ButtonType="Link" ... DeleteText="REMOVE" />

If it is a ButtonField, Text="REMOVE"

<asp:ButtonField ButtonType="Link" ... Text="REMOVE" />

Upvotes: 1

Related Questions