try to put a table like the following in ItemDataBound event handler:
<table border=1><tr><td colspan=2>whatever</td></tr><tr><td>hello</td><td>world</td></tr></table>
protected void DataGrid_OnItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Header)
{
LiteralControl lc = new LiteralControl ("<table border=1><tr><td colspan=2>whatever</td></tr><tr><td>hello</td><td>world</td></tr></table>");
e.Item.Cells[3].Controls.Add(lc);
}
}
<table border=1><tr><td colspan=2>whatever</td></tr><tr><td>hello</td><td>world</td></tr></table>
protected void DataGrid_OnItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Header)
{
LiteralControl lc = new LiteralControl ("<table border=1><tr><td colspan=2>whatever</td></tr><tr><td>hello</td><td>world</td></tr></table>");
e.Item.Cells[3].Controls.Add(lc);
}
}
秋水无恨的办法:当所有的列的都要嵌子列的时候才有用,通常的表格只会有一列到两列才需要嵌套子列的,那怎么办呢?
请问各位有更好的办法吗?