This is a truly stupid question. I have done this a million times with 1.1 and asp.net but cannot figure out how to do this using .net 2.0 and a WINDOWS application.
Basically I have a gridview control which contains some records. The first column contains the primary key for my record. When the user clicks on a row I want to extract the value held in the primarykey column so that I can get that record from my dataset and display it in a series of textboxes for editing.
I am using the CellContentClick event (not sure if this is correct) on my GridView and am extracting the current row "e.RowIndex" but how the hell do I get the contents of the first column called "PrimaryKey"
.

Gridview and getting current row/cell
Rastogi
string test;
int x = dataGridView2.CurrentCell.ColumnIndex; //column
int y = dataGridView2.CurrentCell.RowIndex; //row
test = dataGridView2[x, y].Value.ToString();
Tejal Joshi
SkroSoft
Please tell me how to get the index of the gridview row without selecting the row and by just clicking the template column in that row.
Please help!
Conc
int x = dataGridView2.CurrentCell.ColumnIndex; //column
int y = dataGridView2.CurrentCell.RowIndex; //row
test = dataGridView2[x, y].Value.ToString();