在 asp.net 中更改 gridview 的自动生成的选择列的文本 - 如何? [英] Changing text of an autogenerated select column of a gridview in asp.net - How?

查看:25
本文介绍了在 asp.net 中更改 gridview 的自动生成的选择列的文本 - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改 ASP.NET GridView 控件中自动生成的 "select" 列的文本.文本需要更改为 DataField 的值.

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.

我怀疑有一种非常合乎逻辑的方法可以做到这一点,但我错过了它.我可以通过预渲染事件添加控件和数据,但有没有更简单更好的方法?

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?

推荐答案

使用 TemplateField 并将具有适当 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.

这篇关于在 asp.net 中更改 gridview 的自动生成的选择列的文本 - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆