title: How to make an editable table using ASP.NET Web Pages?
body: <p>I'm fairly new to html development and don't know how to tackle this problem. I need to create a table with some editable cells. Then I need to update a specific row in a database table based in the row edited. I've created some working solution that I'm almost sure don't use a correct approach to the problem, so I need to know how can I can I make this fine.
  Note the <strong>repeated form</strong>. I would like to have only one form and one submit button to update only those edited rows.</p>
  
  <pre><code>@using Oracle.DataAccess.Client;
  @using Oracle.DataAccess.Types;
  @{
  
      string some_conn = "SomeConnectionString";
      OracleConnection conn = new OracleConnection(some_conn);
      var comm = new OracleCommand("select * from some_table",conn);
      conn.Open();
  
  
      if(IsPost){
          var some_id = Request.Form["some_id"];
          var some_value = Request["some_value"];
  
          var update_comm = new OracleCommand("update some_table"+
                                              "   set some_value ='"+some_value+"'" +
                                              " where some_id ='" + some_id + "'", conn ) ;
          update_comm.ExecuteNonQuery();
      }
      var dr = comm.ExecuteReader();
  }
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;table&gt;
              @while(dr.Read()){
                  &lt;tr&gt;
                  @for(int i= 0; i &lt; 7 ; i++){
                      if(i != 5){
                          &lt;td&gt; @(Convert.ToString(dr.GetValue(i)))&lt;/td&gt;    
                      }
                  }
                      &lt;form method="post" action=""&gt;
  
                      &lt;td&gt; &lt;input type="text" name="some_id" contenteditable="false" value="@(Convert.ToString(dr.GetValue(5)))"&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;textarea name="some_value" cols="10" rows="10"&gt;@(Convert.ToString(dr.GetValue(7)))&lt;/textarea&gt;&lt;/td&gt;  
                      &lt;td&gt; &lt;input type="submit" value="update"&gt;&lt;/td&gt;
                      &lt;/form&gt;
              &lt;/tr&gt;
              }
          &lt;/table&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  @{
      conn.Close();
      conn.Dispose();
  
  }
  </code></pre>