title: Is it a good idea to write tables using loops in ASP.net?
body: <p>I've inherited an ASP.net web application where the previous developer used the convention of having an ASP.net GridView for each table that displays data to the user, even if it is not a page that will take advantage of paging or viewstate in any way.</p>
  
  <p>I've become a bit fed up with some of the limitationsand cruft associated with GridView and I'm thinking of rolling my own on some pages.</p>
  
  <p>My questions: "Is this a good idea?"  "What are the pitfalls?"</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>   &lt;table&gt;
          &lt;%=EquipmentTableHeadingsRowHTML() %&gt;
          &lt;%foreach(Entry entry in TableEntries)
            { %&gt;
              &lt;%=WriteTableRowForEntry(entry) %&gt;
         &lt;% } %&gt;
     &lt;/table&gt;
  
      public string WriteTableRowForEntry(Entry entry)
      {
          StringBuilder sb = new StringBuilder();
          sb.Append("&lt;tr&gt;&lt;td&gt;");
          sb.Append(entry.Description);
          sb.Append("&lt;/td&gt;&lt;td&gt;");
          sb.Append(entry.NumberRequired);
          sb.Append("&lt;/td&gt;&lt;td&gt;");
          sb.Append(entry.NumberCurrent);
          sb.Append("&lt;/td&gt;&lt;td&gt;");
          sb.Append(entry.NumberRequired);
          sb.Append("&lt;/td&gt;&lt;td&gt;");
          sb.Append(entry.CostEach);
          sb.Append("&lt;/td&gt;&lt;td&gt;");
          sb.Append("TOTAL COST");
          sb.Append("&lt;/td&gt;&lt;/tr&gt;");
          return sb.ToString();
      }
  </code></pre>