zoukankan      html  css  js  c++  java
  • GridView 双层表头

    GridView 中实现双层表头的主要思路是通过GridView 的RowCreated 方法重写表头.

    要实现如下:

          NPRB表單號&基本資料                        |預計出關日期     |    實際出關日期   |  Delay差異天數

    ---------------------------------------------------------------------------------------------
    NPRB_NO  | BU  |  PM  |  MODEL_NAME   |DESIGN_PLN    |  DESIGN_ACT   |   DESIGN_DEL

    代码如下:

    代码
    protected void gdvReport_RowCreated(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.Header)
            {
                TableCellCollection tcl 
    = e.Row.Cells; 
                tcl.Clear();
                tcl.Add(
    new TableHeaderCell());
                tcl[
    0].ColumnSpan = 4;             //合并列
                tcl[0].Text = "NPRB表單號&基本資料";

                tcl.Add(
    new TableHeaderCell());
                tcl[
    1].Text = "預計出關日期";

                tcl.Add(
    new TableHeaderCell());
                tcl[
    2].Text = "實際出關日期";

                tcl.Add(
    new TableHeaderCell());
                tcl[
    3].Text = "Delay差異天數</th></tr><tr>"// 这里第一层已经写完,以下是第二层

                tcl.Add(
    new TableHeaderCell());
                tcl[
    4].Text = "NPRB_NO";
                tcl.Add(
    new TableHeaderCell());
                tcl[
    5].Text = "BU";
                tcl.Add(
    new TableHeaderCell());
                tcl[
    6].Text = "PM";
                tcl.Add(
    new TableHeaderCell());
                tcl[
    7].Text = "MODEL_NAME";

                    tcl.Add(
    new TableHeaderCell());
                    tcl[
    8].Text = this.ddlPhase.SelectedValue + "_PLN";

                    tcl.Add(
    new TableHeaderCell());
                    tcl[
    9].Text = this.ddlPhase.SelectedValue + "_ACT";

                    tcl.Add(
    new TableHeaderCell());
                    tcl[
    10].Text = this.ddlPhase.SelectedValue + "_DEL";                
                }
          }
    }
  • 相关阅读:
    String类型和包装类型作为参数传递时,是属于值传递还是引用传递呢?
    RPC 框架
    大型分布式电商系统架构演进史?
    框架演变
    SSM和springboot对比
    什么是微服务,SpringBoot和SpringCloud的关系和区别
    Springboot,SSM及SSH的概念、优点、区别及缺点
    Spring Cloud 和dubbo
    LeetCode 048 Rotate Image
    LeetCode 047 Permutations II
  • 原文地址:https://www.cnblogs.com/andycai/p/1616859.html
Copyright © 2011-2022 走看看