如何定义多行内联模板?
例如,此网格具有内联模板(最后一列的格式参数)。在内联模板中有多行html的语法是什么?
@model List<Employee>
@{
View.Title = "Employee List";
}
@{
var grid = new WebGrid(source: Model,
defaultSort: "FirstName",
rowsPerPage: 3);
}
<p>
<h2>Employee List</h2>
<div id="grid">
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("FirstName"),
grid.Column("LastName"),
grid.Column("Salary",format:@<text>$@item.Salary</text>)
)
)
</div>
</p>
答案 0 :(得分:8)
你应该能够拥有多条像fllowing一样的行:
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("FirstName"),
grid.Column("LastName"),
grid.Column("Salary",format:@<text>$@item.Salary<br/>
<p>Here's another line</p>
</text>)
)
)
您是否看到任何特定问题?