Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display total value in the footer

Status
Not open for further replies.

arada1

MIS
Dec 3, 2006
47
US
hi folks,
How can I display the total value on the last page in the footer section with page that has paging is set to true..
below is my code..thank you


Protected Sub gvitems_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvitems.RowDataBound

If e.Row.RowType = DataControlRowType.DataRow Then
Dim EnginnersTotal As Decimal = CType(DataBinder.Eval(e.Row.DataItem, "EngineersEstimate"), Decimal)
EnginersEstimateTotalTotal += EnginnersTotal

Else
If e.Row.RowType = DataControlRowType.Footer Then
'for the footer, display engineers estimate total
e.Row.Cells(4).Text = "Total"
e.Row.Cells(5).Text = EnginersEstimateTotalTotal.ToString("c")
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
End If
End If
End Sub
 
hi folks,
I might not be clear with my question what I want to do is sum the values of first paging and add that to second page.......until i get to the last page which is the end of paging.thank you for your help
 
Why not just get the total from the sql you use to get the orginal data, then display that in the footer?
 
thank you jbenson001 the reason is I want to diplay the total at the bottom of each page and display the Grandtoatal which is the sum i get from each page at the end of the footer in the last page.I am not sure if i could do this using my sql statement. thank you
 
You could get a total in your sql and store it in a column. Then as you page in the grid, show the total only for the page, as you want. Then display the grand total from your result set only if you are on the last page.
 
jbenson001 thank you for your response.Your suggestions makes a lot of sense to me.but my question to you is how can I display the grand total from your result set only if you are on the last page.What do i need to change from my code for to acomplish this.As always I really appreciate your help.
 
You can use the PageIndex and PageCount properties to see which page you are on. If it is the last one, show the control that displays the total.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
thank you ca8msm for the hint I will work on that.thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top