• GridView统计数据和修改Cell


    代码:
        /// <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 = "统计测试";
        }
  • 相关阅读:
    Python脚本抓取京东手机的配置信息
    Python中的Pandas模块
    Python中的Pandas模块
    XML和JSON数据格式
    XML和JSON数据格式
    Linux运维比较常用的一些脚本
    Linux运维比较常用的一些脚本
    Keepalived高可用集群
    Keepalived高可用集群
    Linux中正则表达式和字符串的查询、替换(tr/diff/wc/find)
  • 原文地址:https://www.cnblogs.com/angelfeather/p/1224789.html
Copyright © 2020-2023  润新知