Populate tfoot in ListView

Discussion in 'ASP .Net' started by DavidC, Jan 14, 2010.

  1. DavidC

    DavidC Guest

    I have an aspx page with a ListView bound to a datasource. I added a tfoot
    to the LayoutTemplate and it displays fine. However, I want to place a total
    of data rows into a Label inside the tfoot. I am using the following code in
    the code-behind page but it does not seem to be populating. Can anyone help?

    Protected Sub lvTimesheets_ItemDataBound(ByVal sender As Object, ByVal e
    As System.Web.UI.WebControls.ListViewItemEventArgs) Handles
    lvTimesheets.ItemDataBound
    Dim lbl As Label
    If e.Item.ItemType = ListViewItemType.DataItem Then
    'on a data row (not header/footer)
    intTimesheetCount += 1
    If Not e.Item.FindControl("LblWeek2Units") Is Nothing Then
    lbl = CType(e.Item.FindControl("LblWeek2Units"), Label)
    Dim curAmt As Double = Convert.ToDouble(lbl.Text)
    If curAmt = 0 Then
    dblTotalUnits += curAmt
    End If
    End If
    Else
    If Not e.Item.FindControl("LblTotalUnits") Is Nothing Then
    lbl = CType(e.Item.FindControl("LblTotalUnits"), Label)
    lbl.Text = dblTotalUnits.ToString
    End If
    End If

    End Sub

    --
    David
     
    DavidC, Jan 14, 2010
    #1
    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. Woolly Mittens
    Replies:
    11
    Views:
    2,384
    William Tasso
    Jan 2, 2004
  2. bernhard
    Replies:
    0
    Views:
    5,421
    bernhard
    Aug 17, 2006
  3. shapper

    TFoot

    shapper, Nov 15, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    331
    shapper
    Nov 16, 2007
  4. TonyV
    Replies:
    24
    Views:
    2,032
    dorayme
    Jan 10, 2008
  5. .
    Replies:
    0
    Views:
    793
Loading...

Share This Page