public static MvcHtmlString WriteStaticTable(this HtmlHelper helper, string tableName, ExpressFormsIndexHeader indexHeader, IEnumerable<ExpressFormsIndexRecord> indexRecords) { // TODO: Make this generic so that the data can be formatted in structures besides tables. StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table data-formname='{0}'>", helper.Encode(tableName)); sb.Append(WriteStaticTableHead(helper, tableName, indexHeader)); sb.Append(WriteStaticTableBody(helper, tableName, indexRecords)); sb.AppendLine("</table>"); return new MvcHtmlString(sb.ToString()); }
private static string WriteStaticTableHead(this HtmlHelper helper, string tableName, ExpressFormsIndexHeader indexHeader) { const string headerFormat = "<th>{0}</th>"; StringBuilder sb = new StringBuilder(); sb.AppendLine("<thead><tr>"); foreach (string header in indexHeader.HeaderHtml) { sb.Append(string.Format(headerFormat, header)); } sb.AppendLine("</tr></thead>"); return sb.ToString(); }
private static string WriteStaticTableHead(this HtmlHelper helper, string tableName, ExpressFormsIndexHeader indexHeader) { const string headerFormat = "<th>{0}</th>"; StringBuilder sb = new StringBuilder(); sb.AppendLine("<thead><tr>"); foreach (string header in indexHeader.HeaderHtml) { sb.Append(string.Format(headerFormat, header)); } sb.AppendLine("</tr></thead>"); return(sb.ToString()); }
public static MvcHtmlString WriteStaticTable(this HtmlHelper helper, string tableName, ExpressFormsIndexHeader indexHeader, IEnumerable <ExpressFormsIndexRecord> indexRecords) { // TODO: Make this generic so that the data can be formatted in structures besides tables. StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table data-formname='{0}'>", helper.Encode(tableName)); sb.Append(WriteStaticTableHead(helper, tableName, indexHeader)); sb.Append(WriteStaticTableBody(helper, tableName, indexRecords)); sb.AppendLine("</table>"); return(new MvcHtmlString(sb.ToString())); }