473,399 Members | 3,302 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,399 software developers and data experts.

DataGrid? Sum Calculate?

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.


Nov 19 '05 #1
1 1508
Make a counter and accumulate the values of the column in ItemDataBound
event, Alternatively loop through the rows in PreRender event.

Eliyahu

"Sam" <cy********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pietje de kort | last post by:
Hello, why is the System.Windows.Forms.DataGrid so un-customizable? I am trying to build a DataGrid that will resize it's last column when there is room left over (make it fill the total...
9
by: web1110 | last post by:
Hi y'all, I have resized the columns in a DataGrid and I want to set the width of the DataGrid to fit the columns. Just summing the column widths is too short due to the grid and gray row...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
2
by: Manish | last post by:
Hey folks I am having a weird problem in ASP .Net. My page is in C#. I have a datagrid, which populates based on selection in drop down box on ASP page. This datagrid has template textbox colum in...
6
by: coleenholley | last post by:
I have a Class Module written in VB that calls an RPC (written in COBOL) we have written code to read the data from the RPC, and we create a temporary datatable to store the data from the RPC. This...
4
by: Stu | last post by:
Hi, I have a datagrid which could contain a large volume of data I want to be able to highlight a row and click a calculate button. Obviously the calculate button will cause a form postback and...
2
by: Coleen | last post by:
Hi All :-) I have a Fro?next loop where I have to calculate a grand total. I need to use that grand total to calculate percentages of data from the same For/Next loop. I can't get the grand...
0
by: Agnes | last post by:
After the user delete the row, I need to re-calculate the whole datagrid's invoice amount, So I try the following code. but I am fail. Does anyone know how to do that ? I try the...
3
by: Richard | last post by:
In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit. When the user chooses to add a new line in the datagrid,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.