title: Insert values in gridview manually using textboxes,loops? ASP.NET C#
body: <p>How can i insert values in gridview manually.Actually here is my problem.<code>textboxes</code> generate dynamically according to <code>gridview</code> columns.For examples if gridview columns are 4 then dynamically 4 <code>textboxes</code> generated.Now i want when user insert value in 4 <code>textboxes</code> and press <code>submit</code> button then value insert in <code>gridview</code> in first row.User insert again values in <code>textboxes</code> then press submit then 2nd row inserted in <code>gridview</code>.Keep remember that <code>gridview</code> columns is dynamically.No idea about header.We can just insert values in <code>gridview</code> by using loop.How can i do this.
  Here is my screen shot <a href="https://i.stack.imgur.com/OcWiZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OcWiZ.png" alt="IMG-LINK"></a> </p>
  
  <p>We can't user header.I'm again telling you.I waana insert values using loops e.g <code>gridview.[0][0],gridview[0][1]</code> its just my guess i don't know .Sorry for bad english.
  Here is my save button code : code behind</p>
  
  <pre><code>public void save(object sender, EventArgs e)
  {
      string s = Session["num"].ToString();
      int num = Int32.Parse(s);
      DataTable t = (DataTable)Session["table"];
      DataRow row1 = t.NewRow();
      for(int i=0;i&lt;num;i++){
          TextBox tt = (TextBox)(form.FindControl("txtser" + i.ToString()));
          string str= tt.Text + " ";
      }
      t.Rows.Add(row1);
      Session["table"] = t;
      GridView1.EditIndex = -1;
      GridView1.DataSource = t;
      GridView1.DataBind();
  }
  </code></pre>