473,811 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:SqlDataSou rceControl id="SqlDataSour ceControl1" runat="server"
UpdateCommand=" " SelectCommand=" SELECT * FROM [History_RetireB enefit] order
by costcenterno asc,employeenam e asc,yearnum desc"
AutoGenerateUpd ateCommand="Fal se"
ConnectionStrin g="server='sqls vr';Database='R etire_Benefit'"
DeleteCommand=" "></wmx:SqlDataSour ceControl>
<wmx:MxDataGr id id="MxDataGrid1 " runat="server" PageSize="1000"
DataSourceContr olID="SqlDataSo urceControl1" BorderColor="#C CCCCC"
AllowSorting="T rue" AutoGenerateFie lds="False"
DataMember="His tory_RetireBene fit" AllowPaging="Tr ue" BackColor="Whit e"
CellPadding="3" BorderWidth="1p x" BorderStyle="No ne" Font-Size="X-Small">
<SelectedItemSt yle font-bold="True" forecolor="Whit e"
backcolor="#669 999"></SelectedItemSty le>
<ItemStyle forecolor="Blac k"></ItemStyle>
<FooterStyle forecolor="#000 066" backcolor="Whit e"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="#006 699"></HeaderStyle>
<PagerStyle horizontalalign ="Center" forecolor="#000 066"
backcolor="Whit e" mode="NumericPa ges"></PagerStyle>
<Fields>
<wmx:BoundFie ld DataField="empn o" SortExpression= "empno"
HeaderText="Emp loyeeNo"></wmx:BoundField>
<wmx:BoundFie ld DataField="empn ame" SortExpression= "empname"
HeaderText="Nam e"></wmx:BoundField>
<wmx:BoundFie ld DataField="dept " SortExpression= "dept"
HeaderText="Dep t"></wmx:BoundField>
<wmx:BoundFie ld DataField="Year Num" SortExpression= "YearNum"
HeaderText="Yea r"></wmx:BoundField>
<wmx:BoundFie ld DataField="RBBF " SortExpression= "RBBF"
HeaderText="RBB F"></wmx:BoundField>
<wmx:BoundFie ld DataField="Basi cEarnMTD"
SortExpression= "BasicEarnM TD" HeaderText="Bas icEarnMTD"></wmx:BoundField>
<wmx:BoundFie ld DataField="RBAm ount" SortExpression= "RBAmount"
HeaderText="RBA mount"></wmx:BoundField>
<wmx:BoundFie ld DataField="Inte restAmount"
SortExpression= "InterestAmount "
HeaderText="Int erestAmount"></wmx:BoundField>
<wmx:BoundFie ld DataField="Tota lRBAmount"
SortExpression= "TotalRBAmo unt" HeaderText="Tot alRBAmount"></wmx:BoundField>
<wmx:BoundFie ld DataField="RBty pe" SortExpression= "RBtype"
HeaderText="RBt ype"></wmx:BoundField>
<wmx:BoundFie ld DataField="Cate gory" SortExpression= "Category"
HeaderText="Cat egory"></wmx:BoundField>
</Fields>
</wmx:MxDataGrid>
</form>

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

- How to calculate sum of TotalRBAmount in DataGrid?

Please advise.

Thanks.


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

Eliyahu

"Sam" <cy********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.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:SqlDataSou rceControl id="SqlDataSour ceControl1" runat="server"
UpdateCommand=" " SelectCommand=" SELECT * FROM [History_RetireB enefit] order by costcenterno asc,employeenam e asc,yearnum desc"
AutoGenerateUpd ateCommand="Fal se"
ConnectionStrin g="server='sqls vr';Database='R etire_Benefit'"
DeleteCommand=" "></wmx:SqlDataSour ceControl>
<wmx:MxDataGr id id="MxDataGrid1 " runat="server" PageSize="1000"
DataSourceContr olID="SqlDataSo urceControl1" BorderColor="#C CCCCC"
AllowSorting="T rue" AutoGenerateFie lds="False"
DataMember="His tory_RetireBene fit" AllowPaging="Tr ue" BackColor="Whit e"
CellPadding="3" BorderWidth="1p x" BorderStyle="No ne" Font-Size="X-Small">
<SelectedItemSt yle font-bold="True" forecolor="Whit e"
backcolor="#669 999"></SelectedItemSty le>
<ItemStyle forecolor="Blac k"></ItemStyle>
<FooterStyle forecolor="#000 066" backcolor="Whit e"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="#006 699"></HeaderStyle>
<PagerStyle horizontalalign ="Center" forecolor="#000 066"
backcolor="Whit e" mode="NumericPa ges"></PagerStyle>
<Fields>
<wmx:BoundFie ld DataField="empn o" SortExpression= "empno"
HeaderText="Emp loyeeNo"></wmx:BoundField>
<wmx:BoundFie ld DataField="empn ame" SortExpression= "empname"
HeaderText="Nam e"></wmx:BoundField>
<wmx:BoundFie ld DataField="dept " SortExpression= "dept"
HeaderText="Dep t"></wmx:BoundField>
<wmx:BoundFie ld DataField="Year Num" SortExpression= "YearNum"
HeaderText="Yea r"></wmx:BoundField>
<wmx:BoundFie ld DataField="RBBF " SortExpression= "RBBF"
HeaderText="RBB F"></wmx:BoundField>
<wmx:BoundFie ld DataField="Basi cEarnMTD"
SortExpression= "BasicEarnM TD" HeaderText="Bas icEarnMTD"></wmx:BoundField>
<wmx:BoundFie ld DataField="RBAm ount" SortExpression= "RBAmount"
HeaderText="RBA mount"></wmx:BoundField>
<wmx:BoundFie ld DataField="Inte restAmount"
SortExpression= "InterestAmount "
HeaderText="Int erestAmount"></wmx:BoundField>
<wmx:BoundFie ld DataField="Tota lRBAmount"
SortExpression= "TotalRBAmo unt" HeaderText="Tot alRBAmount"></wmx:BoundField> <wmx:BoundFie ld DataField="RBty pe" SortExpression= "RBtype"
HeaderText="RBt ype"></wmx:BoundField>
<wmx:BoundFie ld DataField="Cate gory" SortExpression= "Category"
HeaderText="Cat egory"></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
1734
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 clientwidth). I am almost capable of doing so by the following actions: - Create a custom DataGridTableStyle called AutoResizeDataGridTableStyle - Hook up the OnResize and OnDataSourceChanged from the AutoResizeDataGridTableStyle to their respected...
9
3946
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 selection column on the left. I have the widths of the columns. What other values do I need to include in the DataGrid width? Thanx,
6
3250
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 entry application. The code below gets line items from a SQL Server database and returns them to a datagrid by way of a DataTable called lineTable. As long as I am just displaying columns in the SQL database everything works well. I now want...
2
5678
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 itemtemplate. Datagrid is something like this- Category Week Amt Week% Button Revenue 1 100 Update Revenue 2 200 Update Cost 1 25 25
6
5335
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 works fine when we call the datatable and bind it to a data grid using datagridname.DataBind(), but I have an ASP table, with calculations using tbl_name.row(1).cells(1) and the result of the calculation is put in a specific row and cell. I have...
4
1342
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 reload all the data. Saving the viewstate could also cause performance problems as it could be large. Is there any way I could on postback keep the data there but just change the
2
2838
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 total until the loop completes, so I have created another datagrid to dump the value of the grand total into. Now, I need to get the total from that datagrid and use it in my original For/Next Loop. Any suggestions on how to do this? I have tried:...
0
1069
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 datagrid.rowchanged/ validated event.. etc. BUT it seems didn't fired (If I press delete ) Public Overrides Function PreProcessMessage(ByRef msg As System.Windows.Forms.Message) As Boolean Dim keyCode As Keys = CType((msg.WParam.ToInt32 And Keys.KeyCode),
3
2327
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, rather than only show that line, I'm displaying all items in the datagrid, with the new line at the bottom. With grdResults ' Set editing on last row .EditItemIndex = .Items.Count .DataSource = ds
0
9728
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
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
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6890
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
3
3018
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.