473,511 Members | 14,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ButtonColumn

I have a datagrid with a ButtonColumn and a BoundColumn with a value.
Without showing the value, how can I make the button send back the value?
Nov 18 '05 #1
1 1724
Hi Roger,

By using a template column you can accomplish your goal without needing the
hidden BoundColumn at all. It is just a matter of putting the value into the
CommandArgument like this:
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Get Value"
CommandName="GetValue" CommandArgument='<%#
DataBinder.Eval(Container.DataItem, "IntegerValue") %>'
CausesValidation="false">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<P>
<asp:Label id="Label1" runat="server"></asp:Label></P>
</form>

Then, when the button is clicked, you can pick up the value from the
CommandArgumentand do whatever you need to do:

Private Sub DataGrid1_ItemCommand _
(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls. _
DataGridCommandEventArgs) _
Handles DataGrid1.ItemCommand
If e.CommandName = "GetValue" Then
Label1.Text = e.CommandArgument.ToString
End If
End Sub

Ken
MVP [ASP.NET]

"Roger" <so*****@microsoft.com> wrote in message
news:em*************@tk2msftngp13.phx.gbl...
I have a datagrid with a ButtonColumn and a BoundColumn with a value.
Without showing the value, how can I make the button send back the value?


Nov 18 '05 #2

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

Similar topics

0
1240
by: Jonathan | last post by:
Hi everyone, i am having a problem with some parameters. I got a datagrid with several columns. My first column is hidden and contains a unique ID for a member. My last column is a buttonColumn....
4
3195
by: CGuy | last post by:
Hi, I have a datagrid that has one ButtonColumn which is bound to a database field. My requirement is that when the page containing the datagrid is loaded, I would like the ButtonColumn to be...
3
2347
by: John | last post by:
The ItemCommand event not getting fired when I add both a BoundColumn and a ButtonColumn to a datagrid. When I add a ButtonColumn by itself, everything works fine, but as soon as I add a...
6
3130
by: z. f. | last post by:
Hi, i have a datagrid with a delete button for each row in the grid. when the delete button is clicked i need to ask the user in a "confirm" message box if he's sure he wants to delete. the...
3
1699
by: ruca | last post by:
Hi gurus, I need to create a ButtonColumn in my code for using in my datagrig. What happens is that I create this button in code, but then when I click him, nothing happens. I have this in my...
1
3390
by: Lenin Sakthees via .NET 247 | last post by:
Hi all, I am using a datagrid to show values from a SQL table. My problem is, I want to show the details of the each row when the user clicks the 'View details' buttoncolumn. I am able to fire a...
2
1721
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...
1
1560
by: Sathyaish | last post by:
How do you get the text of a ButtonColumn control column in a datagrid? As an example, I tried this little snippet on a test project, but it returns a null string. Private Sub...
1
1852
by: Dave | last post by:
On a web form I have a grid, grid1, with a ButtonColumn bound to a field in a table. When the button is clicked I want do do something with the data view in the row clicked. How do I retrieve the...
1
1694
by: nipe | last post by:
Hello, I'm having problem with my custom datagrid control can't fire itemcommand event. The fact is that I have to make fully cutom user control so I can't do any scripting to .aspx file. There...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.