我有一个返回 htmlTable 以供查看的助手。编码:
public static HtmlTable Sales(this HtmlHelper helper)
{
HtmlTable tabela = new HtmlTable();
HtmlTableRow rowHeader = new HtmlTableRow();
HtmlTableCell cellCode = new HtmlTableCell();
HtmlTableCell cellUnd = new HtmlTableCell();
HtmlTableCell cellDescription = new HtmlTableCell();
HtmlTableCell cellQtd = new HtmlTableCell();
tabela.Width = "800px";
cellCode.InnerText = "Código";
cellUnd.InnerText = "Unidade";
cellDescription.InnerText = "Descrição";
cellQtd.InnerText = "QTD";
cellCode.Focus();
rowHeader.Cells.Add(cellCode);
rowHeader.Cells.Add(cellUnd);
rowHeader.Cells.Add(cellDescription);
rowHeader.Cells.Add(cellQtd);
tabela.Rows.Add(rowHeader);
return tabela;
}
但我的观点只是:
System.Web.UI.HtmlControls.HtmlTable
我的回报是 HtmlTable,如何在视图中呈现这个?