How to put an additional summary row on the top of the grid rows with ASPxGridView (Devexpress)?
The default behavour
When I configure total summaries, with the <TotalSummary>
node of my ASPxGridView
, those totals are display at the bottom of the grid.
My goal
My question is how to make them appear both on the top and the bottom of the开发者_StackOverflow grid ? The position of the top total row would be between the header (column captions / filter) and the first data row.
I'm using the 2011v1 release of ASPxGridView and editors product.
If I understand your question clearly,
For the bottom, you can do it normally with totalsummary
,
For the top, you can do it like this;
protected void ASPxLabel1_Load(object sender, EventArgs e)
{
ASPxGridView grid = ASPxGridView1;
GridViewDataColumn col = grid.Columns["UnitsInStock"] as GridViewDataColumn;
ASPxSummaryItem summary = grid.TotalSummary["UnitsInStock",
DevExpress.Data.SummaryItemType.Sum];
string text = summary.GetTotalFooterDisplayText(col, grid.GetTotalSummaryValue(summary));
ASPxLabel label = (ASPxLabel)sender;
label.Text = string.Format("{0}\r\n({1})", col.FieldName, text);
}
It gives you a result like this;
View this How to display a total summary within the column header
精彩评论