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";                
                }
          }
    }
  • 相关阅读:
    如何判断是否是ssd硬盘?win10查看固态硬盘的方法
    MongoDB简单使用 —— 基本操作
    MongoDB简单使用 —— 驱动
    Visual Studio新的 .csporj 文件
    MongoDB简单使用 —— 安装
    关于MongoDB时区问题
    利用dynamic简化数据库的访问
    BrowserLog——使用Chrome控制台作为Log查看器
    在Asp.net core返回PushStream
    使用GIT进行源码管理——GIT托管服务2018
  • 原文地址:https://www.cnblogs.com/andycai/p/1616859.html
Copyright © 2011-2022 走看看