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
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.
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?
Abethan said:Not only the count, i want to display whatever Summary of the child table requested by the user.
I'm not sure what you are looking for here. There's nothing in the grid to automatically roll up summaries into the parent band. The grid could not possibly do this, since it can't make assumptions about the data structure. You will have to code it.
Abethan said:And pls tell me how to do filtering also to all the child rows
See the RowFilterMode property. I think that, by default, the filters only apply to the current rows collection, but you can make them apply to the entire band.
Thanks Mike, Not only the count, i want to display whatever Summary of the child table requested by the user. And pls tell me how to do filtering also to all the child rows..... Looking forward to ur reply.
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