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

Enhanced footers when you expand a detail table

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 07 Nov 2012, 05:50 PM
Hello
I am using a fairly old version of rad controls for asp.net ajax (Q3 2008).
I have a master detail grid. In the footer I am showing some basic aggregate details (which I am actually having to calculate manually as the built in aggregates aren't working properly but thats another story) and I am displaying them in the footer by adding literal controls to get a multiline display:

 

 

 

Protected Sub gridJourneys_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gridJourneys.ItemDataBound
  
        If e.Item.OwnerTableView.Name = "Journeys" Then
            If TypeOf e.Item Is GridDataItem Then
  
  
                Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
                            
  
  
                Dim x As TimeSpan = TimeSpan.Parse(dataItem("IdlingTime").Text)
                idlingTime = (idlingTime + x)
                Dim y As Double = Double.Parse(dataItem("DistanceTravelled").Text)
                distanceTravelled = (distanceTravelled + y)
                Dim z As TimeSpan = TimeSpan.Parse(dataItem("TimeTaken").Text)
                timeTaken = (timeTaken + z)
  
  
  
  
            ElseIf TypeOf e.Item Is GridFooterItem Then
  
                Dim footerItem As GridFooterItem = CType(e.Item, GridFooterItem)
  
                footerItem("DistanceTravelled").Text = distanceTravelled.ToString("F2")
                'footerItem("TimeTaken").Text = timeTaken.ToString
  
  
  
  
                footerItem("TimeTaken").Controls.Add(New LiteralControl("Total: " & timeTaken.ToString & "<br/>"))
                footerItem("TimeTaken").Controls.Add(New LiteralControl("Idling: " & idlingTime.ToString))
  
  
            End If

The footer displays fine when the grid first loads but if I expand a row in the table to show the details table then the footer information for TimeTaken column (which was created using literal controls) is lost. The DistanceTravelled column is fine

thanks

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Nov 2012, 05:49 PM
Hello,

You can try moving your custom code for aggregates inside ItemCreated event instead of ItemDataBound and see if it makes any difference. However, I would suggest that you upgrade to the latest version of RadControls where RadGrid provides an intuitive method to define aggregates on a per-column basis from design time and render the results inside the respective column's footer:
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/aggregates/defaultcs.aspx

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
andieje
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or