zoukankan      html  css  js  c++  java
  • 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;
                }
            }

  • 相关阅读:
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
    Tomcat跨域
    Invalid bean definition with name 'dataSource' defined in class path resource [applicationContext.xml]
    网速测试
    程序员实用工具网站
    安装wls报(主清单位置 "/u01/app/oracle/inventory" 无效 (无法读取/写入/执行))
    pom.xml
    CUDA -- 内存分配
    最长上升子序列(LIS: Longest Increasing Subsequence)
    实例化渲染
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1405490.html
Copyright © 2011-2022 走看看