我正在尝试获取单元格的总和以找到订单总数。这是我的代码
protected void OrdelistDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
decimal sum = 0;
for (int i = 0; i < OrdelistDetails.Rows.Count; ++i)
{
sum += Convert.ToDecimal((OrdelistDetails.Rows[i].FindControl("lblitemTotal") as Label).Text);
}
lblTotal.Text = sum.ToString();
}
它工作正常,但它不添加最后一个单元格