Hi,
i'm not sure if i should be asking this but i'll give it a try and you can feel free to say "forget it"
is there a quick way to have the Band[0] be a summery of Band[1] (parent/child)? instead of me doing it manually for each column
part of the Band[1] columns are Text data and part of them are Numbers data (represented as strings)
at the moment i am binding a dataset that has 2 tables with DataRelation between them most of the columns are the same and visually i would like the band[0] cells will be the summery of the band[1] . but i dont care about the band[0] dataset wise , i only care about the band[1]
thanks
yes that was some of the tweeking needed :) thanks
Hello sharik,
Removing the following foreach statement could help for this:
foreach (UltraGridCell cell in row.Cells)
So the code should become:
foreach (UltraGridRow row in e.Row.ChildBands["Band 1"].Rows) { //foreach (UltraGridCell cell in row.Cells) //{ switch (e.Row.Cells[0].Column.DataType.Name) { case "Decimal": { e.Row.Cells["Column 0 Band 0"].Value = int.Parse(row.Cells["Column 0 Band 1"].Value.ToString()) + int.Parse(e.Row.Cells["Column 0 Band 0"].Value.ToString()); break; } case "String": { e.Row.Cells["string"].Value = e.Row.Cells[0].Value.ToString() + ", " + e.Row.Cells["string"].Value.ToString(); break; } } //} }
foreach (UltraGridRow row in e.Row.ChildBands["Band 1"].Rows) { //foreach (UltraGridCell cell in row.Cells) //{ switch (e.Row.Cells[0].Column.DataType.Name) { case "Decimal": { e.Row.Cells["Column 0 Band 0"].Value = int.Parse(row.Cells["Column 0 Band 1"].Value.ToString()) + int.Parse(e.Row.Cells["Column 0 Band 0"].Value.ToString());
break; }
case "String": { e.Row.Cells["string"].Value = e.Row.Cells[0].Value.ToString() + ", " + e.Row.Cells["string"].Value.ToString();
break; } } //} }
Please do not hesitate to contact me if you need any additional assistance.
really great example !! but if i add another column of type Double and fill it with data then your code will summerize ALL child cells that are double, it does not focuse on the same column as the parent.
in my case the child columns are not exactly as parent columns
parent -> col1 col2 col3 decCol1 DecCol2 ....
child -> col1 decCol1 DecCol2 ....
when i tried it on my project it it had an offset of columns , meaning like the child summery value went into the wrong parent ( one to the left)
when i do it on the DataSet side and not the grid side , then it goes well.
thanks Boris :)
I tried to wrap up quickly a sample for you. I hope that it helps. Please let me know if there is something bothering you.
wow , that code indeed did it .... impressive .....as all your support ...
if there is a way to hide the summery icon/button and apply summery without needing the icon, then this will indeed be very usful for me.... i mean the summery feature.
as for the second, yes this will be strings and the grid is bound to dataset so as for "when" as it loads/binds then the data will be available so i would want it to show immidiately without expanding.
i dont need to summery icon/button to be available for the user, i want to do it all at code behind.
i am going to explore this feature now and understand how it can be done by code behind