protected void ReportGridView_DataBound(object sender, System.EventArgs e)
{
Table ExtraTable = GridView1.Controls(0);
GridViewRow ExtraGridViewRow = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
TableHeaderCell ExtraTableHeaderCell1 = new TableHeaderCell();
ExtraTableHeaderCell1.Text = "First 2 Columns";
ExtraTableHeaderCell1.ColumnSpan = 2;
ExtraGridViewRow.Cells.Add(ExtraTableHeaderCell1);
TableHeaderCell ExtraTableHeaderCell2 = new TableHeaderCell();
ExtraTableHeaderCell2.Text = "Next 3 Columns";
ExtraTableHeaderCell2.ColumnSpan = 3;
ExtraGridViewRow.Cells.Add(ExtraTableHeaderCell2);
TableHeaderCell ExtraTableHeaderCell3 = new TableHeaderCell();
ExtraTableHeaderCell3.Text = "Last 4 Columns";
ExtraTableHeaderCell3.ColumnSpan = 4;
ExtraGridViewRow.Cells.Add(ExtraTableHeaderCell3);
}
Add a header to a gridview that groups some columns
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment