473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
2 3772
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Scott | last post by:
How can you show SUBTOTALS in the same column as the data, NOT in a separate column? I need to SUBTOTAL in the same column as one of the the data columns, like the subtotals 700 and 800 under...
0
by: Mark | last post by:
Is there a way to put a subtotal in a datagrid? For example, let's say I have a datagrid of sales for a given year. No paging. I've used the ItemDataBound event of the datagrid to add totals at...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
2
by: Richard Grene | last post by:
I am creating an Excel spreadsheet using a query function in my vb code. This works fine. I can format the columns but dont know how to create subtotals and a grand total. Thanks, Richard
4
by: Jerry LeVan | last post by:
Is is possible, via some clever sql coding ( perhaps with PL/pgsql) to get subtotals to appear in a selection, ie If I have a query: select * from checks order by category I would like the have...
9
by: latin & geek via DotNetMonster.com | last post by:
hi. ive been searching high and low for help with how to show subtotals for each column in a datagrid. so far ive only seen help for asp.net or c#..... can someone please help for VB.NET? im a...
3
by: Greg | last post by:
I have a database that tracks the vacation time of each employee of the company that I work for. Everything works great and totals all of the vacation time that has been used. Could someone give me...
8
by: xian2 | last post by:
Hi, I have two subreports on my report and they both have a subtotal in the subreport footer section. I have managed to work out how to call the subtotals in to the main form: =!!.. =!!..
0
by: Paul Ilacqua | last post by:
I'm using VB .NET and I'm trying to "roll my own" report subtotals. I'm building a string from a datareader top pass to a reporting class and I want to break and subtotal QTY at each change in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.