/// <summary>
/// 绑定数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridViewXinXiLan_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
totalstock += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "生产量本年实际"));
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[1].Text = "统计";
e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Right;
e.Row.Cells[4].Text = totalstock.ToString();
e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Right;
}
}
/// <summary>
/// 修改数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButtonLoad_Click(object sender, EventArgs e)
{
// 修改数据
GridViewXinXiLan.Rows[5].Cells[4].Text = "test";
GridViewXinXiLan.FooterRow.Cells[4].Text = "统计测试";
}
/// 绑定数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridViewXinXiLan_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
totalstock += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "生产量本年实际"));
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[1].Text = "统计";
e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Right;
e.Row.Cells[4].Text = totalstock.ToString();
e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Right;
}
}
/// <summary>
/// 修改数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButtonLoad_Click(object sender, EventArgs e)
{
// 修改数据
GridViewXinXiLan.Rows[5].Cells[4].Text = "test";
GridViewXinXiLan.FooterRow.Cells[4].Text = "统计测试";
}