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

Enhanced footers when you expand a detail table

1 Answer 28 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
andieje asked on 07 Nov 2012, 05:50 PM
I am using a fairly old version of rad controls for 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


1 Answer, 1 is accepted

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

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:

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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question