Good afternoon,
I create some summary with this code:
column = e.Layout.Bands[2].Columns["ColumnName"];
column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Currency;
ss = column.Band.Summaries.Add(SummaryType.Sum, column);
ss.DisplayFormat = "{0:N2}";
How can I read the value of that Summary?
I tried to reach it with:
gridName.DisplayLayout.Bands[2].Summaries["ColumnName"]
But there's no "value" or "text" property that I can read.
Thanks in advance
Hi Andrea,
You cannot use band to get summary value, you have get it from Rows Collection. For the root band you can get it by doing something like this
this.ultraGrid1.Rows.SummaryValues[SummarySettings].Value
There's no way to get a summary for a child band, because there are no summaries for child bands. Once again, the summary is a summary of a rows collection. So if you want to get summary value for a child band rows collection then you would have to get reference of that particular rows collection and use SummaryValues collection on that.
Please let me know if you have any questions.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer, Windows Formshttp://www.infragistics.com/
Goodmorning,
sorry but I don't understand:
I've got a master-detail, each master record has 2 detail table and each detail table has got a summary like the way I posted before:
If I use your code:
the this.ultraGrid1.Rows.SummaryValues is empty.
If I've got a summary in the band[1] or band[2] how can I read it?
In InitializeRow event you can check for e.Row.Band.Key or e.Row.Band.Index and if it is the band you are interested in then get the summary values of that bands rows collection. For example you can do something like thise.Row.Bands[1].Rows.SummaryValues[" "].Value
Please try this and let me know if you need any further assistance.
To get a child rows collection under a parent row, you do something like this: this.ultraGrid1.Rows[rowIndex].ChildBands[bandIndex/bandKey].RowsOnce you have the rows collection, you can access the SummaryValues just like you do with the root-level rows: this.ultraGrid1.Rows[rowIndex].ChildBands[bandIndex/bandKey].Rows.SummaryValues[summaryIndex/summaryKey].Value
Hi Sahaja,
this code doesnt work cause the e.Row doesn't have a "Bands" collection property (it has only a "Row" property).
But you bring me an idea:
e.Row.ParentCollection can work with the SummaryValues!
Goodafternoon Mike,
this works very well, thanks for all!
Also using the Sahaja's solution (with the ParentCollection idea that I posted before) works really well.