title: how to append string in a HtmlTextWriter asp.net c# webform
body: <p>Let say i have a function like below, which returns option tag as a string.</p>
  
  <pre><code> public static string writeDropDownOptionHTML(string tablename, string id_col, string value_col)
          {
              StringWriter stringwriter = new StringWriter();
              HtmlTextWriter writer = new HtmlTextWriter(stringwriter);
              DataTable dt1 = BAL.setDropDown(tablename, id_col, value_col);
              if (dt1.Rows.Count &gt; 0)
              {
                  foreach (DataRow row in dt1.Rows)
                  {
                      writer.AddAttribute(HtmlTextWriterAttribute.Value, row[0].ToString());
                      writer.RenderBeginTag(HtmlTextWriterTag.Option);
  
                      writer.Write(row[1].ToString());
                      writer.RenderEndTag();
                  }
              }
  
              return stringwriter.ToString();
          }
  </code></pre>
  
  <p>now i have another function like below</p>
  
  <pre><code>public static string writeWalkReverseTableData(DataTable dt1)
          {
              StringWriter stringwriter = new StringWriter();
              HtmlTextWriter writer = new HtmlTextWriter(stringwriter);
  
              if (dt1.Rows.Count &gt; 0)
              {
                  foreach (DataRow row in dt1.Rows)
                  {
  
                      writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                      writer.RenderBeginTag(HtmlTextWriterTag.Td);
                      writer.RenderBeginTag(HtmlTextWriterTag.Select);
                      // now i want to call  writeDropDownOptionHTML which will return option html code
                      // writer += writeDropDownOptionHTML("xyz","abc","def"); 
                      writer.RenderEndTag();
                      writer.RenderEndTag();
                      writer.RenderEndTag();
                  }
              }
              return stringwriter.ToString();
          }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/qolUP.png" alt="enter image description here"></p>
  
  <p>how to append string in a HtmlTextWriter?</p>