How to add ButtonColumn to GridView Programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

C# and asp.net 2.0

I have a <asp:GridView> that I create dinamically.
Now I need to add a ButtonColumn to the GridView.

I have this code:

ButtonColumn btColumn = new ButtonColumn();
btColumn.ButtonType = ButtonColumnType.LinkButton;
btColumn.Text = "myText";
btColumn.CommandName = "myCommand";
gridViewDocm.Columns.Add(btColumn); <-- doesn't work!!!!

How do I do this?
It used to work for DataGrid not for GridView!!!

I appreciate any help you can give.
Thanks,
Joao Rego
 
the gridview does not support button columns. you can add a ButtonField
to its template.

-- bruce (sqlwork.com)
 
Back
Top