LinkButton button = (LinkButton)sender; GridViewRow gvr = button.NamingContainer as GridViewRow; int ri=gvr.RowIndex;