accessing data of a GridView on button click <p>I am having a gridview with some columns and a template field column that contains a button and I want to call a procedure on button click, however I want to pass a value of a column to the procedure but I am getting an error, here is the action listener of the button: (column name in the gridview is team_ID) error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. error line: int team_ID = Convert.ToInt32(Eval("team_ID"));</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { string connStr = ConfigurationManager.ConnectionStrings["MyDbConn"].ToString(); SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand("join_team", conn); cmd.CommandType = CommandType.StoredProcedure; int team_ID = Convert.ToInt32(Eval("team_ID")); string email = Session["email"].ToString(); cmd.Parameters.Add(new SqlParameter("@team_ID", team_ID)); cmd.Parameters.Add(new SqlParameter("@myemail", email)); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } </code></pre>