473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3807
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***@discussi ons.microsoft.c omwrote in message
news:6C******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message
news:6C******** *************** ***********@mic rosoft.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
9429
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 Field 3 below (I really have 21 columns). Also I must show one blank row after each resulting group: Field1 Field2 Field3 Field4 entry1 data2.1 100 data4.1 entry2 data2.2 400 data4.2
0
1517
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 the bottom. I'd like to add quarterly subtotals in the MIDDLE of the grid on their own rows. The data is sorted by default by date, so after the last March record, I want to insert a subtotal. Which event (ItemDataBound or ItemCreated) is the...
6
3042
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 current_row_key of Grid1... to the objectDataSource2 parameter? (so that the second grid, gets only the information to do with current row of grid1)
2
4375
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
3499
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 the subtotals appear (possibly in an unused column for each "category" when the category "breaks". Basically I would like to meld the query: select category, sum(amount) from checks group by category order by
9
3648
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 beginner and do not know VB.NET well, let alone how to convert asp.net to vb!! thanks very much --
3
4388
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 a little guidance on how I could get a subtotal for each employee and then total all of the subtotals? I would like to list employee 1's time and total it, then employee 2's time and total it and so on. Then total all of the subtotals. Not sure...
8
2528
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
1531
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 shipper and I have struggled with the code to do so for days and just can't seem to get it. I can get it to insert a draw a line at a shipper change, but I can't get the subtotals. The actual Code is down below data sample. I appreciate any advice I...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.