代码如下:
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Header)
{
TableCellCollection tcl=e.Item.Cells;
tcl.Clear();
tcl.Add(new TableHeaderCell());
tcl[0].RowSpan = 2;
tcl[0].Text = "日期";
tcl.Add(new TableHeaderCell());
tcl[1].RowSpan = 2;
tcl[1].Text = "合同编号";
tcl.Add(new TableHeaderCell());
tcl[2].RowSpan = 2;
tcl[2].Text = "合同名称";
tcl.Add(new TableHeaderCell());
tcl[3].RowSpan = 2;
tcl[3].Text = "所属项目";
tcl.Add(new TableHeaderCell());
tcl[4].RowSpan = 2;
tcl[4].Text = "供应商";
tcl.Add(new TableHeaderCell());
tcl[5].RowSpan = 2;
tcl[5].Text = "执行部门";
tcl.Add(new TableHeaderCell());
tcl[6].RowSpan = 2;
tcl[6].Text = "承办人";
tcl.Add(new TableHeaderCell());
tcl[7].RowSpan = 2;
tcl[7].Text = "合同总金额";
tcl.Add(new TableHeaderCell());
tcl[8].RowSpan = 2;
tcl[8].Text = "支出方式";
tcl.Add(new TableHeaderCell());
tcl[9].ColumnSpan = 3;
tcl[9].Text = "发票已开</td><td rowspan='2'>发票暂估金额</td><td colspan=4>付款</tr><td rowspan='2'>执行阶段</td></tr><tr><td>发票日期</td><td>发票号</td><td>开票金额</td><td>金额</td><td>日期</td><td>对应发票号</td><td>付款凭证号</td>";
}
}
出来的效果是这样:
表头的样式不统一,再说我也没有加样式,HTML里也没有,为什么会有样式啊!~
怎么解决啊????