GridView header to have a Parent Header(Grouped Header) is as simple as the following.
protected void GrvPrePromotion_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
GridView HeaderGrid = (GridView)sender;
GridViewRow HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
TableCell HeaderCell = new TableCell();
HeaderCell.Text = "Promotion Product Group";
HeaderCell.ColumnSpan = 3;
HeaderGridRow.Cells.Add(HeaderCell);
HeaderGridRow.CssClass = "gridheadtop";
HeaderCell = new TableCell();
HeaderCell.Text = "Sales and SGM";
HeaderCell.ColumnSpan = 4;
HeaderGridRow.Cells.Add(HeaderCell);
HeaderCell = new TableCell();
HeaderCell.Text = "Special Discount";
HeaderCell.ColumnSpan = 3;
HeaderGridRow.Cells.Add(HeaderCell);
HeaderCell = new TableCell();
HeaderCell.Text = "Rebate";
HeaderCell.ColumnSpan = 1;
HeaderGridRow.Cells.Add(HeaderCell);
HeaderCell = new TableCell();
HeaderCell.Text = "Free Goods / Prize";
HeaderCell.ColumnSpan = 1;
HeaderGridRow.Cells.Add(HeaderCell);
GrvPrePromotion.Controls[0].Controls.AddAt(0, HeaderGridRow);
}
}
How to Display/Calculate Total/Percentage in the Gridview footer.
1 comment:
A well written article. Performance heavily depends on the number of rows and on vertical scroll bar position. Thanks for the useful and important information in the article.
http://www.dapfor.com/en/net-suite/net-grid/features/performance
Post a Comment