|
-
Jan 5th, 2010, 12:56 AM
#1
Thread Starter
Addicted Member
How do I add values together from my dataset (with a repeater)?
Alright, second blonde moment for the day!
I've figured out how to use a repeater field, now what I want to achieve is a "total" figure for the column, and this figure needs to appear the footer.
Back in ASP 3.0, I would simply create a variable, and on every step as I looped through the recordset, I would add the current to the variable, including its original value. At the end, I'd have the total. Apparently I can't figure out how to do the same thing in ASP.NET.
This is what I'm doing (which doesn't work):
VB Code:
<asp:SqlDataSource ID="SqlDS_TransactionDetail" runat="server"
ConnectionString="<%$ ConnectionStrings:ArrowConnectionString %>"
SelectCommand="SELECT [QUANTITY], [DESCRIPTION], [SELLING_PRICE], [NET_VALUE], [TAX_VALUE] FROM [ARROW_TO_CRM_DEBTOR_CHECKDETAIL] WHERE (([CRM_GUID] = @CRM_GUID) AND ([REF_ARROW] = @REF_ARROW))">
<SelectParameters>
<asp:Parameter Name="CRM_GUID" Type="String" />
<asp:Parameter Name="REF_ARROW" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<table>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDS_TransactionDetail">
<HeaderTemplate>
<tr>
<td>
NET_VALUE
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#Eval("NET_VALUE")%>
<%intNetValueTotal = Eval("NET_VALUE") + Eval("NET_VALUE")%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
Total: <%=intNetValueTotal%>
</td>
</tr>
</FooterTemplate>
</asp:Repeater>
</table>
Does anyone understand what I am trying to achieve? 
Help!!!!
Cheers,
Scott
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|