Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Add subtotal row to datagrid

Reply
Thread Tools

Add subtotal row to datagrid

 
 
Anon
Guest
Posts: n/a
 
      01-25-2005
hi,

i need to subtotal a column in a datagrid and display the result. I have
come to a point where i can subtotal the columns in the datagrid but cannot
display the result.

ex.
Private Sub dgTimesheet_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgTimesheet.ItemDataBound
If e.Item.Cells(4).Text().GetType Is GetType(System.Double) Then
subtotal += Double.Parse(e.Item.Cells(4).Text())
End If
End Sub

my question is how do i know when the datagrid has finished binding and then
add a literal at the bottom of the grid and display the subtotal.

thanks in advance.

 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      01-26-2005
The datagrid doesn't really support adding a subtotal row, but you can fake
it by overriding the pager row.
Here are the details:
http://devcenter.infragistics.com/Ar...ArticleID=1229

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Anon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hi,
>
> i need to subtotal a column in a datagrid and display the result. I have
> come to a point where i can subtotal the columns in the datagrid but
> cannot
> display the result.
>
> ex.
> Private Sub dgTimesheet_ItemDataBound(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> dgTimesheet.ItemDataBound
> If e.Item.Cells(4).Text().GetType Is GetType(System.Double) Then
> subtotal += Double.Parse(e.Item.Cells(4).Text())
> End If
> End Sub
>
> my question is how do i know when the datagrid has finished binding and
> then
> add a literal at the bottom of the grid and display the subtotal.
>
> thanks in advance.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add subtotal within the footer in Gridview Ken ASP .Net 1 09-02-2007 11:34 AM
Bounded Datagrid and Subtotal rows josepm ASP .Net Web Controls 2 03-29-2006 03:32 PM
Add row under selectedindex row of datagrid ujjc001@gmail.com ASP .Net 0 12-15-2004 12:01 AM
Add row under selectedindex row of datagrid ujjc001@gmail.com ASP .Net 0 12-15-2004 12:00 AM
How to add a new row to a datagrid with values of the selected row =?Utf-8?B?U3VyZXNo?= ASP .Net 1 11-22-2004 09:04 AM



Advertisments