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
ataGrid 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
ataGrid>
<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]