Hi Steve,
Another approach is to use the DataGrid.SelectedIndex property to determine which index in the datagrid is selected. You will want to bind the DataGrid to a DataView to make sure the order of the items displayed is consistent with the order of the records. If the user can't reorder the items then binding to a DataTable will also work. This way you don't have to use a hidden field.
>I have data in a recordset from a VFP table and display that data in an ASP.NET grid. I have a primary key for the table and need to keep track of it, but don't want to display on the screen. I setup the grid to have an extra column named "key" which holds the key value for the record. However, upon saving, I have values for all visible columns, but the invisible "key" column shows no value (the control does exist). If I change the column to visible, then the value is there the next time I populate the grid.
>
>How do I keep track of database columns for a grid without displaying them?
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi