title: Storing values from TextBox in GridView to DataBase?
body: <p>I have a <code>GridView</code> in which i have placed textbox in item template of each column. I want to store the values which I will be entering in the textboxes to the database on button click. </p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      GridView1.Visible = true;
      DataTable dt = new DataTable();
      DataRow row = dt.NewRow();
      for (int i = 0; i &lt; GridView1.Rows.Count; i++)
      {
          string UserID = GridView1.Rows[i].Cells[1].Text;
          string q="insert into details (name) values('"+UserID+"')";
  
          SqlCommand cmd = new SqlCommand(q, con);
          SqlDataAdapter da = new SqlDataAdapter(cmd);
          da.Fill(dt);
      }
  }
  </code></pre>
  
  <p>the problem is that the textboxes are not even visible when i run the page.</p>