DataNavigateUrlFields="TestId" DataNavigateUrlFormatString="~/Test.aspx?TestId={0}" />
HyperLink hypTestLink = (HyperLink)Gv.Rows[gvRow.RowIndex].Cells[testLinkcolumnindex].Controls[0];
ViewStateLinkData = string.IsNullOrWhiteSpace(hypTestLink .Text) ? 0 : Convert.ToInt32(hypTestLink .Text);
Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/kE508u3uWHY/14547