日期:2014-05-18  浏览次数:20494 次

请大家帮我看一下,关于GridView的~~~
我现在GridView下面以经打开脚注了。可是只有一行,怎么样才设置两行那。谢谢帮手了。

------解决方案--------------------
思路是这样的。
首先把footer中合并为一列,然后再这列中添加一个table

if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].ColumnSpan = e.Row.Cells.Count;

Table table = new Table();
table.Width = Unit.Parse( "100% ");
table.GridLines = GridLines.Horizontal;
table.CellPadding = 2;


for (var i = 0; i < 5; i++)
{
TableRow row = new TableRow();
for (var j = 0; j < 3; j++)
{
TableCell cell = new TableCell();
cell.Text = "cell " + j.ToString();

row.Cells.Add(cell);
}

table.Rows.Add(row);
}

e.Row.Cells[0].Controls.Add(table);
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;

for (var i = 1; i < e.Row.Cells.Count; i++)
{
e.Row.Cells[i].Attributes[ "style "] = "display:none; ";
}