ok...
(i don't have nothing, just the idea)
1. get the data from the SP to a SQLClient.DataReader
2. populate the GV with it
GridView.DataSource = dr
GridView.DataBind()
3. set a global variable to save the years (current row and previous row)
and the brand total
Public currentYear as string = ""
Public newYear as string = ""
Public totalForYear as integer = 0
4. in the GridView_DataBound you check if the year changed, imagine that you
present the year in a label
currentYear = ctype( gridview.findcontrol("myYearLabel", Label).Value
if oldYear <> currentYear then
the years are diferent, so Add a row here with the totals
else
oldYear = currentYear
totalForYear += cInt(ctype(gridview.findcontrol("myTotalBrandLabel ",
Label).Value)
end if
5. to add a new row with the variable follow this article for better view of
the idea:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=201
with the data on SQLClient.DataReader you can add row by row manually and
check when the year changes so you can add a new row with totals, must like
classic ASP 3.0
--
Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"John" <> escreveu na mensagem
news:...
> do u have a code snippet of something like this? I can't use the SQL
> (stored procedure) due to its used by other apps that don't want the data
> grouped or rolled up as I need to do on my web for
> "Bruno Alexandre" <> wrote in message
> news:...
>> ok then,
>>
>> using the gridview_rowcreate you can add a row with the totals everytime
>> you change the year
>>
>> or
>>
>> do that in the SQL Statment using GROUP BY Clause
>>
>> --
>>
>> Bruno Alexandre
>> (a Portuguese in Københanv, Danmark)
>>
>>
>> "John" <> escreveu na mensagem
>> news:...
>>>I don't want the total in the footer. I want the total for each year
>>>like this:
>>> Sales 2006:
>>> BMW 100
>>> Lexus 75
>>> Mercedes 70
>>> Total Sales: 245
>>> Sales 2005:
>>> BMW 90
>>> Lexus 40
>>> Mercedes 10
>>> Total Sales: 140
>>>
>>> I will be adding a total in the footer of all the totals, but for this I
>>> want the totals as above.
>>>
>>>
>>>
>>>
>>> "Bruno Alexandre" <> wrote in message
>>> news:...
>>>> it's easy 
>>>>
>>>> in one of the templates add the code
>>>>
>>>> <footerItem>
>>>> <asp:label runat="server" id="lblTotal" text='<%= intTotal %>' />
>>>> </footerItem>
>>>>
>>>> add
>>>> Dim intTotal as Integer = 0
>>>> at the begining of your script (outside Page_Load)
>>>>
>>>> you probably use a function to calculate the totals of the year, just
>>>> add this line toyour code
>>>>
>>>> intTotal += yourBrandTotal
>>>>
>>>> If you are getting the total directly from the Database in a column
>>>> named, for example, tTotal you problable have the code like this in
>>>> your template item
>>>>
>>>> <asp:label runat="server" id="lblBrandTotal" Text='<%# Eval("tTotal")
>>>> %>' />
>>>>
>>>>
>>>> just it for this:
>>>> <asp:label runat="server" id="lblBrandTotal" Text='<%# addTotal(
>>>> Eval("tTotal") ) %>' />
>>>>
>>>> and ad a function called addTotal like:
>>>>
>>>> Function addTotal( myValue as integer ) as integer
>>>> intTotal += myValue
>>>> return myValue
>>>> End function
>>>>
>>>> and that's it 
>>>>
>>>> --
>>>>
>>>> Bruno Alexandre
>>>> (a Portuguese in Københanv, Danmark)
>>>>
>>>>
>>>> "John" <> escreveu na mensagem
>>>> news:...
>>>>> have a gridview where I need to add totals for each grouped data,
>>>>>
>>>>> example
>>>>> my grid looks like this
>>>>> Sales 2006:
>>>>> BMW 100
>>>>> Lexus 75
>>>>> Mercedes 70
>>>>> Total Sales: 245
>>>>>
>>>>> Sales 2005:
>>>>> BMW 90
>>>>> Lexus 40
>>>>> Mercedes 10
>>>>> Total Sales: 140
>>>>>
>>>>> I have the formatting done for all but the Total Sales row, how can I
>>>>> add
>>>>> that to my gridview?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>