更改在asp.net中一个gridview的自动生成的选择列文本 - 如何?自动生成、文本、asp、net

2023-09-04 00:20:24 作者:喜欢装点糊涂

我想改变自动生成的选择列的文本在ASP.NET 的GridView 控制。该文本需要被改变的值数据字段

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 a DataField.

我怀疑有做这是一个非常合乎逻辑的方式,但我很想念它。 我能够通过$ P $添加控件和数据对呈现事件,而是有更简单更好的办法?

I suspect that there is a very logical way to do this but I am missing it. I am able to add controls and data via the pre-render event but is there an easier better way?

推荐答案

使用的模板列并放入它的按钮或linkbuttons适当的CommandName属性:ButtonField.CommandName物业 您可以使用的DataBinder.Eval方法设置此按钮上的文字。

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.