Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > footer totals

Reply
Thread Tools

footer totals

 
 
mark
Guest
Posts: n/a
 
      09-07-2004
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


 
Reply With Quote
 
 
 
 
Greg Burns
Guest
Posts: n/a
 
      09-07-2004
http://www.dotnetjunkies.com/Tutoria...0BDAF711D.dcik

Greg

"mark" <(E-Mail Removed)> wrote in message
news:yDd%c.27$0%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
mark
Guest
Posts: n/a
 
      09-07-2004

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:(E-Mail Removed)...
>

http://www.dotnetjunkies.com/Tutoria...0BDAF711D.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(.Text.ToString = "" Or
Me.Datagrid1.Items(counter).Cells(.Text.ToString = "&nbsp;" Then
Me.Datagrid1.Items(counter).Cells(.Text = ""
Else : dsoi = dsoi + 1
dsoiavg = dsoiavg + Me.Datagrid1.Items(counter).Cells(.Text.ToString
End If

be nice if i could put these totals into the footer - atm im using labels
outside the datagrid



 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-07-2004
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" <(E-Mail Removed)> wrote in message
news:4Kj%c.392$(E-Mail Removed)...
>
> "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
> news:(E-Mail Removed)...
>>

> http://www.dotnetjunkies.com/Tutoria...0BDAF711D.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(.Text.ToString = "" Or
> Me.Datagrid1.Items(counter).Cells(.Text.ToString = "&nbsp;" Then
> Me.Datagrid1.Items(counter).Cells(.Text = ""
> Else : dsoi = dsoi + 1
> dsoiavg = dsoiavg + Me.Datagrid1.Items(counter).Cells(.Text.ToString
> End If
>
> be nice if i could put these totals into the footer - atm im using labels
> outside the datagrid
>
>
>



 
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
Running totals in gridview (when you have many totals required) =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?= ASP .Net 3 02-16-2007 12:03 PM
Showing datagrid totals in the footer =?Utf-8?B?SnVzdGlu?= ASP .Net 9 10-15-2004 09:55 PM
NEWBIE - Column Totals in Footer of mxDataGrid RockNRoll ASP .Net Datagrid Control 3 08-13-2004 12:21 AM
Error trying to get totals in footer ASP .Net 2 07-02-2004 05:42 PM
Totals in grid footer? SStory ASP .Net Datagrid Control 3 05-14-2004 04:11 AM



Advertisments