-1
我正在嘗試獲取單元格的總和以查找總額。這裏是我的代碼獲取gridview單元格的總和不包括最後一個單元格
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();
}
它工作正常,但它不添加的最後一個單元格
你可以嘗試設置斷點事件和檢查多少行存在於網格? – Steve 2013-04-28 22:16:56