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

display last row in footer

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saran kumar
Top achievements
Rank 1
Saran kumar asked on 09 Jan 2010, 09:39 AM
hi
how to display last row of the databind in the grid in footer.
please help.

1 Answer, 1 is accepted

Sort by
0
SURESH
Top achievements
Rank 1
answered on 09 Jan 2010, 10:54 AM
hello Saran kumar

Please Try This given  code in grid itembound. Code here i am using  data field names are username, totalcost, selectdate  .i hope better useful 

  If Session("totalcost") = "" Then
            Dim dt As New DataSet
            Dim name As String = "elumalai"
            Dim sa As MySqlDataAdapter = New MySqlDataAdapter("select username, totalcost, selectdate from sourcemt.totalcost where username='" & name & "'", con)
            sa.Fill(dt)
            Dim count As Integer = dt.Tables(0).Rows.Count

            For r As Integer = 0 To dt.Tables(0).Rows.Count - 1
                Dim username As String = dt.Tables(0).Rows(r).Item("username")
                Dim totalcost As String = dt.Tables(0).Rows(r).Item("totalcost")
                Dim selectdate As String = dt.Tables(0).Rows(r).Item("selectdate")
                Session("totalcost") = totalcost
                Session("username") = username
                Session("selectdate") = selectdate


            Next
            MsgBox(Session("totalcost") & Session("username") & Session("selectdate"))
            Exit Sub
        Else


            If (TypeOf e.Item Is GridFooterItem) Then
                Dim footerItem As GridFooterItem = CType(e.Item, GridFooterItem)
                footerItem("username").Text = Session("username")
                footerItem("totalcost").Text = Session("totalcost")
                footerItem("selectdate").Text = Session("selectdate")
            End If
        End If

Thanks 
suresh.S
Tags
Grid
Asked by
Saran kumar
Top achievements
Rank 1
Answers by
SURESH
Top achievements
Rank 1
Share this question
or