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?