473,378 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to add ButtonColumn to GridView Programmatically

Hello,

C# and asp.net 2.0

I have a <asp:GridViewthat 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

Jan 30 '07 #1
2 12014
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:GridViewthat 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
Jan 30 '07 #2
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:GridViewthat 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

Jan 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
2
by: John Mason | last post by:
Hi, I have a datagrid of invoices with a buttoncolumn that users can click on to pay a particular invoice. Once the invoice is paid, the datagrid is reloaded, however, the button to pay the...
3
by: Mark Parter | last post by:
I have a GridView control which is bound to a Stored Procedure (SP) using a SQLDataSource. The problem I'm having is that the SP returns 4 known columns and x amount of unknown columns. I can...
1
by: | last post by:
I'm wondering if it's possible, outside of the declaration of an ASP.NET 2.0 GridView, to programmatically style individual columns. For example, I might want to make the text in a particular...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Brian McClellan | last post by:
Just wondering if anyone has a simple example of creating a gridview completely programmatically, i'm not doing anything terribly sophisticated. When creating the gridview declaratively evertying...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
5
by: NKaufman | last post by:
<asp:GridView ID="Basic" runat="server" DataKeyNames="QuestionID,isHeading" AutoGenerateColumns="false" AllowPaging="true" PageSize="100"> <Columns> <asp:BoundField Visible="false"...
7
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
Is there a way to use a gridview in a timecard application, and if so, how? I was looking at using a gridview to display a person's hours worked in a week. To do this, many different data records...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.