Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created January 26, 2012 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/de43f6bb97843de388d3 to your computer and use it in GitHub Desktop.
Save anonymous/de43f6bb97843de388d3 to your computer and use it in GitHub Desktop.
public static XElement XCreateTable(this HtmlHelper helper, IEnumerable<XAttribute> attributes = null, object tHeadData = null, IEnumerable<Tuple<XAttribute[], IEnumerable<object>>> tRowsContent = null)
{
return new XElement(
"table",
attributes,
new XElement("thead", tHeadData),
new XElement("tbody", tRowsContent.Select(helper.XCreateTableRow));
}
public static XElement XCreateTableRow(this HtmlHelper helper, Tuple<XAttribute[], IEnumerable<object>> tRowData)
{
return new XElement("tr", tRowData.Value1, tRowData.Select(helper.XCreateTableCell));
}
public static XElement XCreateTableCell(this HtmlHelper helper, params object[] content)
{
return new XElement("td", content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment