467,080 Members | 1,081 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,080 developers. It's quick & easy.

Subtotals in Gridview

I have searched the net but have been unable to find a solution to
subtotaling in a gridview. I have a gridview that is bounded to sqldatasource
where I would like to subtotal rows throughout the gridview based on column
value "Type". I am using VB.NET. Thanks.
--
Hutty
Jul 22 '08 #1
  • viewed: 3496
Share:
2 Replies
The way to do this sort of things is to use a repeater or a listview with
ItemTemplate made out of two html table rows. The first <trwill be used as
a regular row. The second <trwill contain subtotals. It will be hidden for
all items (rows) but the last item for each Type. You will need to handle
either ItemDataBound or PreRender event to calculate the subtotals, detect
the last item for every Type and show the subtotal <trfor the detected
last items.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Hutty" <Hu***@discussions.microsoft.comwrote in message
news:6C**********************************@microsof t.com...
>I have searched the net but have been unable to find a solution to
subtotaling in a gridview. I have a gridview that is bounded to
sqldatasource
where I would like to subtotal rows throughout the gridview based on
column
value "Type". I am using VB.NET. Thanks.
--
Hutty

Jul 23 '08 #2
I failed to mention I am using a nested gridview in application. The second
gridview shows the details of the master gridview where I want to display
totals. My goal is to show hierarchial data with subtotals at major
intervals. Will the repeater accomplish this task? Thanks.
--
Hutty
"Eliyahu Goldin" wrote:
The way to do this sort of things is to use a repeater or a listview with
ItemTemplate made out of two html table rows. The first <trwill be used as
a regular row. The second <trwill contain subtotals. It will be hidden for
all items (rows) but the last item for each Type. You will need to handle
either ItemDataBound or PreRender event to calculate the subtotals, detect
the last item for every Type and show the subtotal <trfor the detected
last items.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Hutty" <Hu***@discussions.microsoft.comwrote in message
news:6C**********************************@microsof t.com...
I have searched the net but have been unable to find a solution to
subtotaling in a gridview. I have a gridview that is bounded to
sqldatasource
where I would like to subtotal rows throughout the gridview based on
column
value "Type". I am using VB.NET. Thanks.
--
Hutty


Jul 23 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Scott | last post: by
reply views Thread by Mark | last post: by
6 posts views Thread by Nalaka | last post: by
2 posts views Thread by Richard Grene | last post: by
4 posts views Thread by Jerry LeVan | last post: by
9 posts views Thread by latin & geek via DotNetMonster.com | last post: by
3 posts views Thread by Greg | last post: by
reply views Thread by Paul Ilacqua | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.