DataGrid单元格合并函数
public void fDGrid_PreRender(object sender, System.EventArgs e)
{
if(this.fDGrid.Items.Count <=1)
{
return;
}
for( int col=0;col<5;col++)
{
TableCell oldtc = this.fDGrid.Items[0].Cells[col];
for(int i=1;i<this.fDGrid.Items.Count;i++)
{
TableCell tc = this.fDGrid.Items[i].Cells[col];
if(tc.Text == oldtc.Text)
{
tc.Visible = false;
if(oldtc.RowSpan == 0)
{
oldtc.RowSpan = 1;
}
oldtc.RowSpan = oldtc.RowSpan +1;
oldtc.VerticalAlign = VerticalAlign.Middle;
}
else
{
oldtc = tc;
}
}
}
}
public void fDGrid_PreRender(object sender, System.EventArgs e)
{
if(this.fDGrid.Items.Count <=1)
{
return;
}
for( int col=0;col<5;col++)
{
TableCell oldtc = this.fDGrid.Items[0].Cells[col];
for(int i=1;i<this.fDGrid.Items.Count;i++)
{
TableCell tc = this.fDGrid.Items[i].Cells[col];
if(tc.Text == oldtc.Text)
{
tc.Visible = false;
if(oldtc.RowSpan == 0)
{
oldtc.RowSpan = 1;
}
oldtc.RowSpan = oldtc.RowSpan +1;
oldtc.VerticalAlign = VerticalAlign.Middle;
}
else
{
oldtc = tc;
}
}
}
}
浙公网安备 33010602011771号