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

Formatting Summary Row while grouped

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin Gartmann
Top achievements
Rank 2
Martin Gartmann asked on 03 Jul 2011, 10:54 AM
Hi All,

i have the following code to convert a integer value (seconds) to double and i wish to oput it like 00:10:15 (615 seconds) in my summary row.

Private Sub rgvWechselProtokoll_GroupSummaryEvaluate(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs) Handles rgvWechselProtokoll.GroupSummaryEvaluate
       If e.Parent Is Me.rgvWechselProtokoll.MasterTemplate Then
           Dim fulltime As String
           fulltime = Date.FromOADate(CDbl(e.Value) / 86400)
           e.FormatString = String.Format("Gesamtzeit = {0:T}", fulltime)
       End If
   End Sub

This is working while m grid is not grouped.

I want to have the same formatting when grouped. Currently my code looks like this

        Me.rgvWechselProtokoll.Columns.Add("Sekunden")
      Me.rgvWechselProtokoll.Columns("Sekunden").IsVisible = False
 
      Dim summaryItem As New GridViewSummaryItem()
      summaryItem.Name = "Start"
      summaryItem.AggregateExpression = "Sum(Sekunden)"
      summaryItem.FormatString = "Gesamt = {0}"
 
 
      Dim summaryRowItem As New GridViewSummaryRowItem()
      summaryRowItem.Add(summaryItem)
     
      Me.rgvWechselProtokoll.SummaryRowsBottom.Add(summaryRowItem)
 
so that i will see my seconds as Integer. When i change my first block to

Private Sub rgvWechselProtokoll_GroupSummaryEvaluate(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs) Handles rgvWechselProtokoll.GroupSummaryEvaluate
    If e.Parent Is Me.rgvWechselProtokoll.MasterTemplate Or IsNumeric(e.Value) Then
        Dim fulltime As String
        fulltime = Date.FromOADate(CDbl(e.Value) / 86400)
        e.FormatString = String.Format("Gesamtzeit = {0:T}", fulltime)
    End If
End Sub

then the formatting is also added when my summery value isNumeric, but this way seems just to be a workaround.

How to apply the same formatting from my first code block using Events or AggregateExpression and FormatString the correct way

Kind regards

Martin Gartmann

2 Answers, 1 is accepted

Sort by
0
Martin Gartmann
Top achievements
Rank 2
answered on 04 Jul 2011, 06:18 AM
Hi again,

found the answer to my question. Using 
If e.SummaryItem.Name = "Start" Then
   Dim fulltime As String
       fulltime = Date.FromOADate(CDbl(e.Value) / 86400)
       e.FormatString = String.Format("Gesamtzeit = {0:T}", fulltime)
End If

did the jobs based on the individual name of the item

Thank you anyway for your attention

Martin Gartmann
0
Martin Vasilev
Telerik team
answered on 06 Jul 2011, 01:36 PM
Hi Martin,

I am glad you have managed to find a solution for your requirement. Do not hesitate to contact us again if you have any other enquires.

Regards,
Martin Vasilev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Martin Gartmann
Top achievements
Rank 2
Answers by
Martin Gartmann
Top achievements
Rank 2
Martin Vasilev
Telerik team
Share this question
or