This is a migrated thread and some comments may be shown as answers.

Gridview SummaryItem

3 Answers 141 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Munish Sharma
Top achievements
Rank 1
Munish Sharma asked on 18 Feb 2010, 12:20 AM
Hi Team,

I have a question to ask.

I have printed the summary totals at the bottom of the grid and also exporting well in ms-excel. I am also trying to print the grid with the print preview and other features(not using telerik reporting). My complete data is showing in the print preview except of the summary totals.

Is there any way to retrieve the SummaryItem values at runtime(in some user defined function)? If yes, can you please help me with
this?

Please find attached screenshot for your reference.

Thanks in advance

Cheers,
Munish Sharma

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 18 Feb 2010, 12:37 PM
Hi Munish Sharma,

Thank you for contacting us.

Say you have a SummaryItem:

GridViewSummaryItem item3 = new GridViewSummaryItem("A", "Min: {0:F2}", GridAggregateFunction.Min);

You can evaluate its value for the template by using GetSummayValue function and passing the Root group:

object value =  item3.GetSummaryValue(grid.MasterGridViewTemplate.Root);

Do not hesitate to write me back if you have further questions.

Greetings,
Nick
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Munish Sharma
Top achievements
Rank 1
answered on 18 Feb 2010, 11:30 PM
Thanks a lot. I used the code you sent as my logic and it worked. Following is the code to print the summary totals......

========================================================================================================

 

 

If

 

dgv.MasterGridViewTemplate.SummaryRowsBottom.Count = 1 Then

 

 

 

 

 

 

 

 

For Each item As GridViewSummaryItem In dgv.MasterGridViewTemplate.SummaryRowsBottom.Item(0)

 

 

 

If Cel.ColumnInfo.FieldName = item.FieldName AndAlso ColumnTypes(i) Is GetType(GridViewTextBoxColumn) Then

 

 

 

 

 

 

 

 

'MessageBox.Show(item.GetSummaryValue(dgv.MasterGridViewTemplate.Root))

 

 

 

 

 

 

 

 

Try

 

 

 

 

 

 

e.Graphics.DrawString(item.GetSummaryInfo(dgv.MasterGridViewTemplate.Root).ToString,

 

New Font("Arial", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)), _

 

 

 

New SolidBrush(Cel.CellElement.ForeColor), _

 

 

 

New RectangleF(ColumnLefts(i), tmpTop, ColumnWidths(i), _

 

CellHeight), StrFormat)

 

 

Catch ex As Exception

 

 

 

End Try

 

 

 

 

 

 

 

 

 

End If

 

 

 

 

 

 

 

 

Next

 

 

 

 

 

 

 

 

End If

 

 

 

 

========================================================================================================

Cheers,

Munish Sharma

 

 

 

 

 

0
Nick
Telerik team
answered on 19 Feb 2010, 08:58 AM
Hi Munish Sharma,

Thank you for providing a code snippet to the community.

Kind regards,
Nick
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Munish Sharma
Top achievements
Rank 1
Answers by
Nick
Telerik team
Munish Sharma
Top achievements
Rank 1
Share this question
or