PC Review


Reply
Thread Tools Rate Thread

How to add ButtonColumn to GridView Programmatically

 
 
=?Utf-8?B?Sm9hbyBSZWdv?=
Guest
Posts: n/a
 
      30th Jan 2007
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



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      30th Jan 2007
the gridview does not support button columns. you can add a ButtonField
to its template.

-- bruce (sqlwork.com)

Joao Rego wrote:
> 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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?Sm9hbyBSZWdv?=
Guest
Posts: n/a
 
      31st Jan 2007
Hi bruce,

Thanks for the tip.


"bruce barker" wrote:

> the gridview does not support button columns. you can add a ButtonField
> to its template.
>
> -- bruce (sqlwork.com)
>
> Joao Rego wrote:
> > 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
> >
> >
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically populate a GridView John Straumann Microsoft ASP .NET 2 23rd May 2008 02:07 PM
GridView generated programmatically NKaufman Microsoft ASP .NET 5 3rd Apr 2007 04:44 PM
how to add programmatically a boundfield to a gridview? michel Microsoft ASP .NET 1 17th Feb 2007 04:52 PM
Using GridView programmatically Mike P Microsoft C# .NET 0 30th May 2006 02:52 PM
Add GridView Row Programmatically Chris Microsoft ASP .NET 0 20th Apr 2006 08:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:31 PM.