Hello,
Can i add 2 footer caption to differentiate Average and summary? Check the below example
Charge Type
Charge 1
Charge 2
Charge 3
AAA
10
20
30
BBB
CCC
DDD
Average
Summary
40
80
120
if i can, can i get sample code for this?
Thanks,
Mayank
Hi,
There are different approaches to solve this task. If you want you could implement CreationFIlter. Another possible solution (without CreationFilter ) could be:
public Form1()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("ChargeType", typeof(string));
dt.Columns.Add("Charge 1", typeof(decimal));
dt.Columns.Add("Charge 2", typeof(decimal));
dt.Columns.Add("Charge 3", typeof(decimal));
dt.Rows.Add("AAA", 10, 20, 30);
dt.Rows.Add("BBB", 10, 20, 30);
dt.Rows.Add("CCC", 10, 20, 30);
dt.Rows.Add("DDD", 10, 20, 30);
ultraGrid1.DataSource = dt;
ultraGrid1.DisplayLayout.Bands[0].SummaryFooterCaption = "Average";
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 1"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries[1].Appearance.BackColor = Color.White;
ultraGrid1.DisplayLayout.Bands[0].Summaries[1].DisplayFormat = "Summary";
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 1"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 2"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries[4].Appearance.BackColor = Color.White;
ultraGrid1.DisplayLayout.Bands[0].Summaries[4].DisplayFormat = " ";
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 2"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 3"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries[7].Appearance.BackColor = Color.White;
ultraGrid1.DisplayLayout.Bands[0].Summaries[7].DisplayFormat = " ";
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 3"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
}
private void ultraGrid1_Paint(object sender, PaintEventArgs e)
SummaryValueUIElement a = ultraGrid1.DisplayLayout.UIElement.GetDescendant(typeof(SummaryValueUIElement), ultraGrid1.DisplayLayout.Bands[0].Summaries[1]) as SummaryValueUIElement;
if (a != null)
a.Offset(-133, 0);
[/code]
Let me know if you have any questions
Thanks for replying me Georgi. I already did this. However i wanted summary different way. As i showed you in my example, i want one row (FooterCaption) as Average and another row as Sum. I do not want Average, Sum associated in each every average,sum column.
Check the example grid as i showed you.
Can i do that?
Sample :
Hello Mayank,
Maybe you could try the code below:
Please take a look on attached sample for more details and if you have any questions, feel free to write me
Regards