Let say i have a function like below, which returns option tag as a string.
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 > 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();
}
now i have another function like below
public static string writeWalkReverseTableData(DataTable dt1)
{
StringWriter stringwriter = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(stringwriter);
if (dt1.Rows.Count > 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();
}
how to append string in a HtmlTextWriter?