Try this code inside your templatefield of the grid view
<pre lang="xml"><ItemTemplate>
<button class="view" onclick="window.location='./ViewDetails.aspx?Id=<%# DataBinder.Eval(Container.DataItem,"Id") %>'; return false;"></button>
the Id should be the primary or unique key .