Hi Experts,
The above picture shows a parent table and a child table in an Ultragrid. I want to get the total number of Purchase Orders in all jobs. (I.E) the above grid should show, the total number of Purchase Order(Count) = "4" (Summery Value)
How to do that?
Pls help me regarding this....
Thx
You would have to implement a sort've roll-up if you want to do this with summaries.
So what I would do is handle the InitializeLayout event of the grid. Add a Count summary to the child band. Add an unbound column to the root band - You can set this colmun's Hidden to true, if you like, so it's not visible to the user. Then you create a Sum summary for the parent band on the unbound column.
Then all you have to do is copy the value of the summary in the child band into the unbound cell in the parent row. So you would do this in InitializeRow. Trap for rows in the parent band, then get the SummaryValue from the child rows collection of that parent row:
e.Row.Cells["unbound column"].Value = e.Row.ChildBands[0].Rows.SummaryValues["my count summary"].Value
Hi MIke, Found this article to be useful for something I am doing. I have a grid consisting of 4 bands. I am trying to grab separate summaries in band[2] and apply each individually to my band[1] unbound fields and using the InitializeRow event. Obviously this event is called every time an row is initialized, and obviously it fires when it hits the first row in my band[0]. Is there way to get the event to skip over the first two bands' rows and just grab the values from my band[2] rows?
Also I noticed that InitializeRow doesn't seem to automatically firing as does InitializeLayout for the WinGrids, therefore, from my WinForm constructor I am defining the eventhandler (e.g.
private void MyForm_Load(object sender, EventArgs e) {gv.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(gv_InitializeRow);}
Unfortunately for me the InitializeRow event is firing before completion of my InitializeLayout event, and before the code where I set up the summaries for the 2nd band and as such, I run into a familiar tome I've encountered; Key Not found exceptions in my InitializeRow event.Can you assist?
Hi,
There's no way to make the event fire for only certain bands, but you can easily ignore the event for bands you are not interesting in. All you have to do is check e.Row.Band.Key or e.Row.Band.Index and return from the event handler if it's not the band you want.
To deal with the event firing before the summaries are created, you should use the Exists method on the Summaries collection of the band and bail out if the summary does not yet exist. The event will fire again once the summary does exist.