Formatting Summary Row while grouped

3 posts, 0 answers
  1. Martin Gartmann
    Martin Gartmann avatar
    51 posts
    Member since:
    Apr 2004

    Posted 03 Jul 2011 Link to this post

    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. Martin Gartmann
    Martin Gartmann avatar
    51 posts
    Member since:
    Apr 2004

    Posted 04 Jul 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 06 Jul 2011 Link to this post

    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!

Back to Top