Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 327
John S Avatar asked Jun 03 '11 20:06

John S


1 Answers

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.

like image 87
Yuriy Rozhovetskiy Avatar answered Sep 25 '22 06:09

Yuriy Rozhovetskiy