use link button or any button but you have to pass command argument like written below
<asp:linkbutton id="LinkButton1" runat="server" causesvalidation="False" commandname="Edit" commandargument="<%# Container.DataItemIndex %>" xmlns:asp="#unknown"> </asp:linkbutton>
after that you can get Rowindex from code behind like this
int RowIndex = Convert.ToInt32(e.CommandArgument.ToString());