in the onclick event of your button:
Button btn = (Button)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
By using this code you have the gridview row in which the button was clicked.
Then:
TextBox myTextBox = (TextBox)row.FindControl("nameOfYourTextBoxHere");
if (myTextBox != null)
myTextBox.Text = "any text you wnat to place in the textbox";