Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Rena Jones   on Nov 04 In Asp.net Category.

  
Question Answered By: Clayton Richardson   on Nov 04

Your code  is totaly unoptimized. You get data for each item, and header and footer. You should put everything inside if statement and don't forget to cast types. when calculating price and displaying it in Text property of TableCell. It's strange that you don't get any casting errors.

Your variable indexInDataGrid is of the same value when calculating sum. You don't actually calculate  on each row  of the DataTable. "foreach" statement should be excanged with "for" statement with counter to calculate the sum.

for (int i = 0; i<myTable.ROws.Count; i++)
 sum  += (Double)myTable.Row[i]["totaleprijs"];

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Calculate Total Sum Or get search suggestion and latest updates.


Tagged: