Changing text of auto-generated gridview selection column in asp.net - How?

I would like to change the text of an auto-generated column "select"in an ASP.NET control GridView. The text must be changed to a value DataField.

I suspect there is a very logical way to do this, but I do not see it. I can add controls and data through a pre-render event, but is there an easier way?

+5
source share
5 answers

Use a TemplateField and place buttons or link buttons in it with the corresponding CommandName property: ButtonField.CommandName Property You can set this button text using the DataBinder.Eval method.

+5
source

The easiest way I've found to do this is to call the DataBind () call just before the gridview control is displayed.

        foreach (GridViewRow row in gvAgreementList.Rows)
        {
            LinkButton lb = (LinkButton) row.Cells[0].Controls[0];
            lb.Text = "Edit";
        }
+6
source

<column> :

<asp:CommandField ShowSelectButton="True" SelectText="Save" />

AutoGenerateSelectButton="True" Gridview.

+4

, GridView .. GridView, commandfieldsSelect, SelectText.

( ShaileshK )

+3

Go to the GridVIew .. tasks at the top of the right GridView button, and then click on editing the columns. In the selected field section, click on the selection field. change the value of the selected text. done.

+2
source

All Articles