id ItemId ItemName Qty Price 1 4 Idly 1 25.00 2 5 Dosa 2 50.00 3 4 Idly 2 50.00 4 2 vada 2 30.00 5 4 Idly 1 25.00
id ItemId ItemName Qty Price 1 4 Idly 4 100.00 2 5 Dosa 2 50.00 4 2 vada 2 30.00
for(Condition) { if(ItemId == TempItemId)//Check the ItemId for duplicate { //Sum those values Qty = Qty + TempQty; Price = Price + TempPrice; //Save into other object(Array or something), so you will get 3 rows instead of 5 rows finally } }
var newI = items.GroupBy(i => i.ItemId).Distinct(); foreach (var item in newI) { Response.Write(item.First() + "<BR/>"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)