Check this code snippet
int rowIndex;
for(rowIndex = 0; rowIndex < myGrdView.Rows.Count; rowIndex++)
{
LinkButton ObjlnkBtn = new LinkButton();
ObjlnkBtn.Text = "Click";
//Let myGrdView.Rows[i].Cells[0].Text contains the item ID
ObjlnkBtn.PostBackUrl = "EditPage.aspx?ID=" + myGrdView.Rows[i].Cells[0].Text;
//Add Link button to the fifth column of each row in the GridView
myGrdView.Rows[i].Cells[5].Controls.Add(ObjlnkBtn);
}