footer totals

Discussion in 'ASP .Net' started by mark, Sep 7, 2004.

  1. mark

    mark Guest

    im keeping running totals of certain columns in a datagrid, id like to put
    these totals in the footer - how do i do this ? or how can i put a label
    into the footer ? (im displaying results using labels instead at the moment)
    eg



    Label5.Text = "Column 1 Total:- " & mordraw & " (Ratio " &
    FormatNumber(ddpercent, 2) "%)"



    id like that putting in the column1 footer if possible
    thanks
    mark
    mark, Sep 7, 2004
    #1
    1. Advertising

  2. mark

    Greg Burns Guest

    http://www.dotnetjunkies.com/Tutorial/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik

    Greg

    "mark" <> wrote in message
    news:yDd%c.27$0%...
    > im keeping running totals of certain columns in a datagrid, id like to put
    > these totals in the footer - how do i do this ? or how can i put a label
    > into the footer ? (im displaying results using labels instead at the
    > moment)
    > eg
    >
    >
    >
    > Label5.Text = "Column 1 Total:- " & mordraw & " (Ratio " &
    > FormatNumber(ddpercent, 2) "%)"
    >
    >
    >
    > id like that putting in the column1 footer if possible
    > thanks
    > mark
    >
    >
    Greg Burns, Sep 7, 2004
    #2
    1. Advertising

  3. mark

    mark Guest

    "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
    news:...
    >

    http://www.dotnetjunkies.com/Tutorial/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik
    >
    > Greg
    >

    thanks for the link but ive looked there before - it doesnt appear relevant,
    im totalling on runtime using code behind like this :-

    If Me.Datagrid1.Items(counter).Cells(8).Text.ToString = "" Or
    Me.Datagrid1.Items(counter).Cells(8).Text.ToString = "&nbsp;" Then
    Me.Datagrid1.Items(counter).Cells(8).Text = ""
    Else : dsoi = dsoi + 1
    dsoiavg = dsoiavg + Me.Datagrid1.Items(counter).Cells(8).Text.ToString
    End If

    be nice if i could put these totals into the footer - atm im using labels
    outside the datagrid
    mark, Sep 7, 2004
    #3
  4. mark

    Greg Burns Guest

    I didn't look to had a the link, it is a good starting place.

    I do my totaling in ItemDataBound event of datagrid:

    Private Sub grid_ItemDataBound(ByVal sender As System.Object, ByVal e As
    System.Web.UI.WebControls.DataGridItemEventArgs) Handles grid.ItemDataBound

    If e.Item.ItemType = ListItemType.Footer Then


    Dim dt As DataTable = CType(ViewState("MyData"), DataTable)
    Dim dv As New DataView(dt)
    dv.RowFilter = "Type <> 5" ' don't include LOW entries!!!


    Dim ColTotal(7) As HourX10

    Dim drv As DataRowView

    For Each drv In dv

    For j As Integer = 0 To 7
    ColTotal(j) += CType(drv("Day" & (j + 1).ToString),
    HourX10)
    Next
    Next

    For j As Integer = 0 To MyTSDetails.WorkDays - 1
    With CType(e.Item.Cells(Columns.Day1 + j).FindControl("Day"
    & j + 1 & "Total"), Label)
    .Text = FooterDate(MyTSDetails.WorkDays - j - 1,
    ColTotal(j))
    End With
    Next

    Dim GrandTotal As HourX10
    For j As Integer = 0 To 7
    GrandTotal += ColTotal(j)
    Next

    Dim c As TableCell = e.Item.Cells(Columns.Total)
    CType(c.FindControl("lblGrandTotal"), Label).Text =
    FooterGrandTotal(GrandTotal)


    End If
    End Sub

    (Sorry I didn't generalize it more before posting)

    Greg

    "mark" <> wrote in message
    news:4Kj%c.392$...
    >
    > "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
    > news:...
    >>

    > http://www.dotnetjunkies.com/Tutorial/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik
    >>
    >> Greg
    >>

    > thanks for the link but ive looked there before - it doesnt appear
    > relevant,
    > im totalling on runtime using code behind like this :-
    >
    > If Me.Datagrid1.Items(counter).Cells(8).Text.ToString = "" Or
    > Me.Datagrid1.Items(counter).Cells(8).Text.ToString = "&nbsp;" Then
    > Me.Datagrid1.Items(counter).Cells(8).Text = ""
    > Else : dsoi = dsoi + 1
    > dsoiavg = dsoiavg + Me.Datagrid1.Items(counter).Cells(8).Text.ToString
    > End If
    >
    > be nice if i could put these totals into the footer - atm im using labels
    > outside the datagrid
    >
    >
    >
    Greg Burns, Sep 7, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    442
    Guest
    Jul 2, 2004
  2. =?Utf-8?B?SnVzdGlu?=

    Showing datagrid totals in the footer

    =?Utf-8?B?SnVzdGlu?=, Oct 14, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    4,586
    =?Utf-8?B?SnVzdGlu?=
    Oct 15, 2004
  3. =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=

    Running totals in gridview (when you have many totals required)

    =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=, Feb 15, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    855
    Alexey Smirnov
    Feb 16, 2007
  4. SStory

    Totals in grid footer?

    SStory, May 11, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    167
    Saravana [MVP]
    May 14, 2004
  5. RockNRoll

    NEWBIE - Column Totals in Footer of mxDataGrid

    RockNRoll, Aug 12, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    147
    Alvin Bruney [MVP]
    Aug 13, 2004
Loading...

Share This Page