protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow) return;
if (e.Row.FindControl("btn_choice") != null)
{
Button btn_choice = (Button)e.Row.FindControl("btn_choice");
btn_choice.Click += new EventHandler(btn_choice_Click);
}
}
private void btn_choice_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
GridViewRow gvr = (GridViewRow)button.Parent.Parent;
string pk = GridView1.DataKeys[gvr.RowIndex].Value.ToString();
}