calculating the column totals in Infragistics Ultragrid

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.
KavyaVAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZeonFlashCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KavyaVAuthor Commented:
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
ZeonFlashCommented:
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
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

KavyaVAuthor Commented:
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
ZeonFlashCommented:
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
KavyaVAuthor Commented:
Thank u Zeonflash.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.