GridViewSummaryItem item1 = new GridViewSummaryItem("SDSR", "{0:#0,##0.00}", GridAggregateFunction.Sum);
GridViewSummaryItem item2 = new GridViewSummaryItem("SNDSR", "{0:#0,##0.00}", GridAggregateFunction.Sum);
GridViewSummaryItem item4 = new GridViewSummaryItem("pl_rub", "{0:#0,##0.00}", GridAggregateFunction.Sum);
GridViewSummaryItem item5 = new GridViewSummaryItem("pl_agent", "{0:#0,##0.00}", GridAggregateFunction.Sum);
GridViewSummaryItem item11 = new GridViewSummaryItem("SDSR", "{0:N2}", GridAggregateFunction.Sum);
GridViewSummaryItem item21 = new GridViewSummaryItem("SNDSR", "{0:N2}", GridAggregateFunction.Sum);
GridViewSummaryItem item41 = new GridViewSummaryItem("pl_rub", "{0:N2}", GridAggregateFunction.Sum);
GridViewSummaryItem item51 = new GridViewSummaryItem("pl_agent", "{0:N2}", GridAggregateFunction.Sum);
GridViewSummaryRowItem row = new GridViewSummaryRowItem(new GridViewSummaryItem[] { item1, item2, item4, item5, item6 });
this.radGridView7.SummaryRowsTop.Add(row);
this.radGridView7.SummaryRowsBottom.Add(row);
this.radGridView7.MasterTemplate.ShowTotals = true;//--------
///////////
this.radGridView7.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Top;
this.radGridView7.MasterView.SummaryRows[1].PinPosition = PinnedRowPosition.Bottom;
GridViewSummaryRowItem summaryRowItem1 = new GridViewSummaryRowItem();
summaryRowItem1.Add(item11);
summaryRowItem1.Add(item21);
summaryRowItem1.Add(item41);
summaryRowItem1.Add(item51);
radGridView7.MasterTemplate.SummaryRowGroupHeaders.Add(summaryRowItem1);
13 Answers, 1 is accepted
for this example ...
Thank you for writing.
In order to hide the summary rows inside the groups you can use the ViewRowFormatting event:
private void RadGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e){ if (e.RowElement.RowInfo is GridViewSummaryRowInfo && e.RowElement.RowInfo.Group != null) { e.RowElement.RowInfo.Height = 1; }}I hope this helps. Should you have any other questions do not hesitate to ask.
Dimitar
Telerik
Now i need the way to fastern data export if there are too many rows in grid. To do that i thought the only data i need is group headers with appropriate sums in their columns cells .So im just hide childrows and use DoNotExport feature for hidden rows.
foreach (GridViewRowInfo row in this.radGridView7.Rows)
{
bool isVisible = false;
foreach (GridViewRowInfo childRow in radGridView7.ChildRows)
{
if (row == childRow)
{
isVisible = false;
}
}
row.IsVisible = isVisible;
}
And now i got pic. gr02.So i need to disable summaryrow with blue font(Group SummaryRow) but retain summaryRow with red font(SummaryRow for whole grid).
Before getting to your question, I wanted to mention that we already provide some means for faster export, one is if you do not export the grid's visual styles for the cells and the other one is to use our async exporting, which again does not export visual settings, and also, as it runs asynchronously, it does not block your application.
As to the question at hand, here is one approach you can use to hide the data rows in the groups:
private void radButton1_Click(object sender, EventArgs e){ foreach (GridViewRowInfo row in radGridView1.ChildRows) { if (row is GridViewGroupRowInfo) { HideDataRowsRecursively(row.ChildRows); } }}void HideDataRowsRecursively(GridViewChildRowCollection childRows){ foreach (GridViewRowInfo row in childRows) { if (row is GridViewDataRowInfo) { row.IsVisible = false; } if (row is GridViewGroupRowInfo) { HideDataRowsRecursively(row.ChildRows); } }}I hope that you find this information useful.
Regards,
Stefan
Telerik
Im still need visuals.
And im still need a method to hide SummaryRows for groups, cause i can hide rows even with this part
foreach (GridViewRowInfo row in this.radGridView7.Rows)
{
row.IsVisible = false;
}
But after export, as u can see at the pic.gr02 there are still SummaryRows from childrows( blue font) .And i thought there is a method to hide them before export starts.
After the export passes, you can make your rows visible again.
Regards,
Stefan
Telerik
private void radButton1_Click(object sender, EventArgs e){ radGridView1.MasterTemplate.ExpandAllGroups(); foreach (GridViewRowInfo row in radGridView1.ChildRows) { if (row is GridViewGroupRowInfo) { HideDataRowsRecursively((GridViewGroupRowInfo)row); } }}void HideDataRowsRecursively(GridViewGroupRowInfo groupRow){ foreach (GridViewSummaryRowInfo summaryRow in groupRow.TopSummaryRows) { summaryRow.IsVisible = false; } foreach (GridViewSummaryRowInfo summaryRow in groupRow.BottomSummaryRows) { summaryRow.IsVisible = false; } foreach (GridViewRowInfo row in groupRow.ChildRows) { if (row is GridViewDataRowInfo) { row.IsVisible = false; } if (row is GridViewGroupRowInfo) { HideDataRowsRecursively((GridViewGroupRowInfo)row); } }}Let me know how this works for you.
Regards,
Stefan
Telerik
If TypeOf e.RowElement.RowInfo Is GridViewSummaryRowInfo AndAlso e.RowElement.RowInfo.Group IsNot Nothing Then e.RowElement.RowInfo.IsVisible = FalseEnd IfCould you please specify what is purpose of posting this code in the previous reply. Are you experiencing any undesired behavior? Do you need any assistance with achieving a certain requirement?
I am looking forward to your reply.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Hi,
I was also having the same requirement to hide the summary rows of child rows. I have followed the solution recommended by Mr. Dimitar (Admin) and found a thin line visible in the summary of child rows. Then, I tried "e.RowElement.RowInfo.IsVisible = False" it worked. So I thought it may be helpful for others too.
Regards


