How to add ButtonColumn to GridView Programmatically

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
 
B

bruce barker

the gridview does not support button columns. you can add a ButtonField
to its template.

-- bruce (sqlwork.com)
 
G

Guest

Hi bruce,

Thanks for the tip.


bruce barker said:
the gridview does not support button columns. you can add a ButtonField
to its template.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top