Team -

I hope you can give me a hand here. I am working on a shopping cart type site which displays products in a datalist. I need to find a way to add up all the products and place that total in a label outside of the datalist.

Also, any opinions if I should use a datalist or a repeater control are also welcome! (can't use datagridview).

Thank you all for your help.

Dewayne

I don't know the type of data source you have used.

if DataTable/DataSet then code should be,

int total=0;
 foreach(DataRow r in dt.Rows)
  {
    total = total +  ((int)r["total"]);
  }
 ...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.