?
Solved

calculating the column totals in Infragistics Ultragrid

Posted on 2008-02-02
6
Medium Priority
?
7,192 Views
Last Modified: 2013-12-17
The Infragistics UltraGrid is populated with dataset.It has 2 columns Volume and VolumeChanged. How to calculate the column totals? The user can edit the cell values. In this case the user has to recalculate
the totals by clicking the calculate button.
0
Comment
Question by:KavyaV
  • 3
  • 3
6 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 2000 total points
ID: 20804872
You can add row summaries to any columns you wish, and it will automatically recalculate the total for you.  The attached code is a very simple way of adding summation summaries to the two columns you're interested in.  There are plenty of ways to tweak the calculation, placement, and appearance...just consult the API.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum,this.ultraGrid1.DisplayLayout.Bands[0].Columns["Volume"]);
this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum,this.ultraGrid1.DisplayLayout.Bands[0].Columns["VolumeChanged"]);
}

Open in new window

0
 

Author Comment

by:KavyaV
ID: 20805073
ZeonFlash,
ThankYou.
How to assign the column total to the labels?

I will try this and let u know whether it is working or not.  How to consult the API.
I need lot more information about the  ultraWinGrid. Pls suggest me some good source.

You answered my ulraWinGrid CombinedDate column question, it's not working. I posted the comment.
Can u pls see my comment and help me.
0
 
LVL 17

Assisted Solution

by:ZeonFlash
ZeonFlash earned 2000 total points
ID: 20823214
The API should be installed when you install Infragistics.  Look for Infragistics in your Start menu, then open the ".NET Help Center".

Sorry for not being much help when it comes to code, but I've never used C# and it's difficult to come up with examples!  That being said, I think you're asking how to get the value of the column total and assign it to a label?  You can do that like so:
label1.Text = this.ultraGrid1.Rows.SummaryValues[0].SummaryText;

Open in new window

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:KavyaV
ID: 20827912
ZeonFlash,Thanks for your comment.
I tried  column summaries.It is not giving the column sum.
 It is showing errors in the InitializeLayout event.
Error: The name 'SummaryType' does not exist in the current context.
0
 
LVL 17

Assisted Solution

by:ZeonFlash
ZeonFlash earned 2000 total points
ID: 20840563
To fix that, you can either add to the top of the form:

using Infragistics.Win.UltraWinGrid;

OR qualify the SummaryType a little more by adding the Infragistics namespace in front of it like this:


this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum,this.ultraGrid1.DisplayLayout.Bands[0].Columns["Volume"]);
this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum,this.ultraGrid1.DisplayLayout.Bands[0].Columns["VolumeChanged"]);

Open in new window

0
 

Author Comment

by:KavyaV
ID: 20840909
Thank u Zeonflash.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question