DataGrid? Sum Calculate?

S

Sam

I successfully created DataGrid with connected environment but how do I
perform sum of TotalRBAmount in DataGrid?


Coding of ASP.Net 1.1
------------------------

<form runat="server">
<wmx:SqlDataSourceControl id="SqlDataSourceControl1" runat="server"
UpdateCommand="" SelectCommand="SELECT * FROM [History_RetireBenefit] order
by costcenterno asc,employeename asc,yearnum desc"
AutoGenerateUpdateCommand="False"
ConnectionString="server='sqlsvr';Database='Retire_Benefit'"
DeleteCommand=""></wmx:SqlDataSourceControl>
<wmx:MxDataGrid id="MxDataGrid1" runat="server" PageSize="1000"
DataSourceControlID="SqlDataSourceControl1" BorderColor="#CCCCCC"
AllowSorting="True" AutoGenerateFields="False"
DataMember="History_RetireBenefit" AllowPaging="True" BackColor="White"
CellPadding="3" BorderWidth="1px" BorderStyle="None" Font-Size="X-Small">
<SelectedItemStyle font-bold="True" forecolor="White"
backcolor="#669999"></SelectedItemStyle>
<ItemStyle forecolor="Black"></ItemStyle>
<FooterStyle forecolor="#000066" backcolor="White"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="White"
backcolor="#006699"></HeaderStyle>
<PagerStyle horizontalalign="Center" forecolor="#000066"
backcolor="White" mode="NumericPages"></PagerStyle>
<Fields>
<wmx:BoundField DataField="empno" SortExpression="empno"
HeaderText="EmployeeNo"></wmx:BoundField>
<wmx:BoundField DataField="empname" SortExpression="empname"
HeaderText="Name"></wmx:BoundField>
<wmx:BoundField DataField="dept" SortExpression="dept"
HeaderText="Dept"></wmx:BoundField>
<wmx:BoundField DataField="YearNum" SortExpression="YearNum"
HeaderText="Year"></wmx:BoundField>
<wmx:BoundField DataField="RBBF" SortExpression="RBBF"
HeaderText="RBBF"></wmx:BoundField>
<wmx:BoundField DataField="BasicEarnMTD"
SortExpression="BasicEarnMTD" HeaderText="BasicEarnMTD"></wmx:BoundField>
<wmx:BoundField DataField="RBAmount" SortExpression="RBAmount"
HeaderText="RBAmount"></wmx:BoundField>
<wmx:BoundField DataField="InterestAmount"
SortExpression="InterestAmount"
HeaderText="InterestAmount"></wmx:BoundField>
<wmx:BoundField DataField="TotalRBAmount"
SortExpression="TotalRBAmount" HeaderText="TotalRBAmount"></wmx:BoundField>
<wmx:BoundField DataField="RBtype" SortExpression="RBtype"
HeaderText="RBtype"></wmx:BoundField>
<wmx:BoundField DataField="Category" SortExpression="Category"
HeaderText="Category"></wmx:BoundField>
</Fields>
</wmx:MxDataGrid>
</form>

Question ?
----------

- How to calculate sum of TotalRBAmount in DataGrid?



Please advise.

Thanks.
 
E

Eliyahu Goldin

Make a counter and accumulate the values of the column in ItemDataBound
event, Alternatively loop through the rows in PreRender event.

Eliyahu

Sam said:
I successfully created DataGrid with connected environment but how do I
perform sum of TotalRBAmount in DataGrid?


Coding of ASP.Net 1.1
------------------------

<form runat="server">
<wmx:SqlDataSourceControl id="SqlDataSourceControl1" runat="server"
UpdateCommand="" SelectCommand="SELECT * FROM [History_RetireBenefit] order
by costcenterno asc,employeename asc,yearnum desc"
AutoGenerateUpdateCommand="False"
ConnectionString="server='sqlsvr';Database='Retire_Benefit'"
DeleteCommand=""></wmx:SqlDataSourceControl>
<wmx:MxDataGrid id="MxDataGrid1" runat="server" PageSize="1000"
DataSourceControlID="SqlDataSourceControl1" BorderColor="#CCCCCC"
AllowSorting="True" AutoGenerateFields="False"
DataMember="History_RetireBenefit" AllowPaging="True" BackColor="White"
CellPadding="3" BorderWidth="1px" BorderStyle="None" Font-Size="X-Small">
<SelectedItemStyle font-bold="True" forecolor="White"
backcolor="#669999"></SelectedItemStyle>
<ItemStyle forecolor="Black"></ItemStyle>
<FooterStyle forecolor="#000066" backcolor="White"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="White"
backcolor="#006699"></HeaderStyle>
<PagerStyle horizontalalign="Center" forecolor="#000066"
backcolor="White" mode="NumericPages"></PagerStyle>
<Fields>
<wmx:BoundField DataField="empno" SortExpression="empno"
HeaderText="EmployeeNo"></wmx:BoundField>
<wmx:BoundField DataField="empname" SortExpression="empname"
HeaderText="Name"></wmx:BoundField>
<wmx:BoundField DataField="dept" SortExpression="dept"
HeaderText="Dept"></wmx:BoundField>
<wmx:BoundField DataField="YearNum" SortExpression="YearNum"
HeaderText="Year"></wmx:BoundField>
<wmx:BoundField DataField="RBBF" SortExpression="RBBF"
HeaderText="RBBF"></wmx:BoundField>
<wmx:BoundField DataField="BasicEarnMTD"
SortExpression="BasicEarnMTD" HeaderText="BasicEarnMTD"></wmx:BoundField>
<wmx:BoundField DataField="RBAmount" SortExpression="RBAmount"
HeaderText="RBAmount"></wmx:BoundField>
<wmx:BoundField DataField="InterestAmount"
SortExpression="InterestAmount"
HeaderText="InterestAmount"></wmx:BoundField>
<wmx:BoundField DataField="TotalRBAmount"
SortExpression="TotalRBAmount"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top