protected void dgStatData_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
TableCellCollection tcc = e.Item.Cells;
int intcount = tcc.Count;
tcc[0].RowSpan = 2;
tcc[1].RowSpan = 2;
tcc[2].RowSpan = 2;
tcc[3].RowSpan = 2;
tcc[0].CssClass = "DGHeaderStyle";
tcc[1].CssClass = "DGHeaderStyle";
tcc[2].CssClass = "DGHeaderStyle";
tcc[3].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[17].Attributes.Add("colspan", "4");
tcc[17].Text = "行驶里程(Km)";
tcc[17].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[18].Attributes.Add("colspan", "5");
tcc[18].Text = "停留点";
tcc[18].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[19].Attributes.Add("colspan", "4");
tcc[19].CssClass = "DGHeaderStyle";
tcc[19].Text = "定位异常</th></tr><tr class='DGHeaderStyle'>";
for (int i = 4; i < intcount; i++)//开始合并的列索引
{
tcc.Add(tcc[4]);
}
}
}
{
if (e.Item.ItemType == ListItemType.Header)
{
TableCellCollection tcc = e.Item.Cells;
int intcount = tcc.Count;
tcc[0].RowSpan = 2;
tcc[1].RowSpan = 2;
tcc[2].RowSpan = 2;
tcc[3].RowSpan = 2;
tcc[0].CssClass = "DGHeaderStyle";
tcc[1].CssClass = "DGHeaderStyle";
tcc[2].CssClass = "DGHeaderStyle";
tcc[3].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[17].Attributes.Add("colspan", "4");
tcc[17].Text = "行驶里程(Km)";
tcc[17].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[18].Attributes.Add("colspan", "5");
tcc[18].Text = "停留点";
tcc[18].CssClass = "DGHeaderStyle";
tcc.Add(new TableHeaderCell());
tcc[19].Attributes.Add("colspan", "4");
tcc[19].CssClass = "DGHeaderStyle";
tcc[19].Text = "定位异常</th></tr><tr class='DGHeaderStyle'>";
for (int i = 4; i < intcount; i++)//开始合并的列索引
{
tcc.Add(tcc[4]);
}
}
}