Hi,
The idea is to fill your hiddenField when user select a row from the gridview.
First you should add the SelectedIndexchanged event in the Gridview Tag :
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="false" OnSelectedIndexChanged = "OnSelectedIndexChanged">
you code behind should look like this :
protected void OnSelectedIndexChanged(object sender, EventArgs e)
{
string id = GridView1.SelectedRow.Cells[0].Text;
string id = (GridView1.SelectedRow.FindControl("id") as Label).Text;
hfId.Text = id;
}
once the user click on the input button, you just have to get the hidden field value
protected void lnkUpdate_Click(object sender, EventArgs e)
{
int selectedId = Convert.toInt32(hfId.Text);
}
If i misunderstood, and the Hidden field is in the gridview, everything showen earlier is still valid, you just have to fill a global variable instead of the hidden field (when user select a row), and access it when the user click the linkbutton.
Hope it helps.