Changing text of an autogenerated select column of a gridview in asp.net - How?

前端 未结 5 1111
遥遥无期
遥遥无期 2020-12-20 19:59

I would like to change the text of the autogenerated \"select\" column in an ASP.NET GridView control. The text needs to be changed to the value of

相关标签:
5条回答
  • 2020-12-20 20:12

    First remove auto generated select then go to GridView tasks.. top right Button of GridView and then click on commandfields -> Select then edit SelectText.

    (Edited answer of ShaileshK with some changes)

    0 讨论(0)
  • 2020-12-20 20:27

    Use the TemplateField and place into it buttons or linkbuttons with appropriate CommandName property: ButtonField.CommandName Property You may set this button text using DataBinder.Eval method.

    0 讨论(0)
  • 2020-12-20 20:28

    Go to GridVIew tasks.. top right Button of GridView and then click on edit columns In selected fields section Click on select field. change the value of select text. done.

    0 讨论(0)
  • 2020-12-20 20:29

    The easiest way I found to do this is after the calling DataBind() just before the gridview control is displayed.

            foreach (GridViewRow row in gvAgreementList.Rows)
            {
                LinkButton lb = (LinkButton) row.Cells[0].Controls[0];
                lb.Text = "Edit";
            }
    
    0 讨论(0)
  • 2020-12-20 20:34

    after <column> write this:

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

    and remove AutoGenerateSelectButton="True" from Gridview attribute.

    0 讨论(0)
提交回复
热议问题