check this on button keypress event
if(e.Keychar == (char)13)
{
string strSQLconnection = "Data Source=dbServer;Initial Catalog=testDB;Integrated Security=True";
SqlConnection sqlConnection = new SqlConnection(strSQLconnection);
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM TABLENAME", sqlConnection);
sqlConnection.Open();
SqlDataReader reader = sqlCommand.ExecuteReader();
GridView1.DataSource = reader;
GridView1.DataBind();
GridView1.Visible = true;
GridView1.Focus();
}
hope this will help you
Also check this link for reference
How to populate DataGridView, GridView with SQL statement in C#[
^]