• GridView跨行


            string logo = "";
            int i = 0;
            int j = 0;
            protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                //if(e.Row.RowType==DataControlRowType.Header)
                //{
                //    e.Row.Cells[1].ColumnSpan = 2;
                //    e.Row.Cells[2].Visible = false;
                //    return;
                //}
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    if (i == 0)
                    {
                        logo = e.Row.Cells[1].Text;
                        i++;
                    }
                    else
                    {
                        if (logo == e.Row.Cells[1].Text)//如果这一行与上一行的相等
                        {
                            j++;
                        }
                        else
                        {
                            this.GridView1.Rows[i - 1 - j].Cells[1].RowSpan = j + 1;
                            for (int x = j; x > 0; x--)
                            {
                                this.GridView1.Rows[i - x].Cells[1].Visible = false;
                            }

                            j = 0;
                            logo = e.Row.Cells[1].Text;
                        }
                        i++;
                    }           

                }
                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    this.GridView1.Rows[i - 1 - j].Cells[1].RowSpan = j + 1;
                    for (int x = j; x > 0; x--)
                    {
                        this.GridView1.Rows[i - x].Cells[1].Visible = false;
                    }

                    j = 0;
                    logo = e.Row.Cells[1].Text;
                }
            }

  • 相关阅读:
    以太坊DApp开发(2):以太坊智能合约开发环境搭建以及第一个Dapp
    以太坊DApp开发(1):入门-开发环境搭建
    全文搜索引擎 Elasticsearch (四)MySQL如何实时同步数据到ES
    nginx 添加https 配置
    spring boot 2.0.3+spring cloud (Finchley)6、配置中心Spring Cloud Config
    linux中没有dos2UNIX或者UNIX2dos命令解决办法
    linux 安装redis4.0
    maven 不同环境打包命令
    PowerShell 中使用 mvn 编译报错 Unknown lifecycle phase ".test.skip=true". 解决办法
    通过更改scrapy源码进行spider分发实现一个综合爬虫
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1405490.html
Copyright © 2020-2023  润新知