Wie erhält man die Summe der Werte aus der Liste?
Ich möchte die Summe der Werte aus der Liste erhalten.
Beispiel: Ich habe 4 Werte in Liste 1 2 3 4 Ich möchte diese Werte summieren und in Label anzeigen
Code:
protected void btnCalculate_Click(object sender, EventArgs e)
{
string monday;
TextBox txtMonTot;
List<string> monTotal = new List<string>();
if (Application["mondayValues"] != null)
{
List<string> monValues = Application["mondayValues"] as List<string>;
for (int i = 0; i <= gridActivity.Rows.Count - 1; i++)
{
GridViewRow row = gridActivity.Rows[i];
txtMonTot = (TextBox)row.FindControl("txtMon");
monday = monValues[i];
monTotal.Add(monday);
}
}
}
Irgendwelche Ideen? Danke im Voraus