我需要页脚的gridview摘要...
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
decimal totalPrice = 0M;
int totalItems = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblPrice = (Label)e.Row.FindControl("lblPrice");
decimal price = Decimal.Parse(lblPrice.Text);
totalPrice += price;
totalItems += 1;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblTotalPrice = (Label)e.Row.FindControl("lblTotalPrice");
lblTotalPrice.Text = totalPrice.ToString();
}
}
但它不起作用。有任何想法吗?