troubleshooting Question

Grid Control Footer Totals in wrong position

Avatar of netsmithcentral
netsmithcentralFlag for United States of America asked on
ASP.NET
5 Comments1 Solution523 ViewsLast Modified:
I have a working Grid control where the footer displays column totals using the code behind file.  For some reason the positioning is off and some column totals are missing from the Grid.  I can't figure out what I did wrong in the code to cause this.

I attached both code and the resulting Grid.  Why are the totals misaligned?
Public Class Dashboard
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Dim TotalIssued As Integer = 0
    Dim TotalAssigned As Integer = 0
    Dim TotalComplete As Integer = 0
    Dim TotalRemaining As Integer = 0
    Dim TotalCancelled As Integer = 0

    Protected Sub RowDataBound(ByVal sender As Object, ByVal e As GridRowEventArgs)
        If e.Row.RowType = GridRowType.DataRow Then
            TotalIssued += Int32.Parse(e.Row.Cells(2).Text)
            TotalAssigned += Int32.Parse(e.Row.Cells(3).Text)
            TotalComplete += Int32.Parse(e.Row.Cells(4).Text)
            TotalRemaining += Int32.Parse(e.Row.Cells(5).Text)
            TotalCancelled += Int32.Parse(e.Row.Cells(6).Text)
        ElseIf e.Row.RowType = GridRowType.ColumnFooter Then
            e.Row.Cells(1).Text = "Total:"
            e.Row.Cells(2).Text = TotalIssued.ToString()
            e.Row.Cells(3).Text = TotalAssigned.ToString()
            e.Row.Cells(4).Text = TotalComplete.ToString()
            e.Row.Cells(5).Text = TotalRemaining.ToString()
            e.Row.Cells(6).Text = TotalCancelled.ToString()

        End If
    End Sub
End Class
Look at the Totals positioning
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros