title: Create a SQL query with conditions from a radio button and radio button list ASP.NET
body: <p>I am currently using Visual Studio 2015. Right now, I am able to connect to the Database using SqlConnection and show the data in a gridview. This code is in the Result page.</p>
  
  <pre><code>private void BindGrid()
      {
          string strConnString = ConfigurationManager.ConnectionStrings["SQL"].ConnectionString;
          using (SqlConnection con = new SqlConnection(strConnString))
          {
              if (Interface_trial_1.RadioButtonList1.Checked == true)
              { 
                  using (SqlCommand cmd = new SqlCommand("SELECT * FROM [dbo].[Emp]"))
              {
                      using (SqlDataAdapter sda = new SqlDataAdapter())
                      {
                          cmd.Connection = con;
                          sda.SelectCommand = cmd;
                          using (DataTable dt = new DataTable())
                          {
                              sda.Fill(dt);
                              GridView1.DataSource = dt;
                              GridView1.DataBind();
                          }
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>However, I do not know how to run a query with conditions from a radio button and a radio button list in the Index page. In addition, I have no clue on how to transfer the value of a radio button or a radio button list from the Index page to the Result page. </p>
  
  <p>Would it be better if I were to run the query in the Index page and show the data in the Result page or transfer the values from the Index page and run the query in the Result page?</p>
  
  <p>Please advice. I am in need of guidance. Thanks in advance!</p>