• GridView 自定义表头


    //修改表头
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
    switch (e.Row.RowType)
    {
    case DataControlRowType.Header:

    TableCellCollection tcHeader = e.Row.Cells;
    tcHeader.Clear();

    //第一行表头
    tcHeader.Add(new TableHeaderCell());
    tcHeader[0].Text = "日期";
    tcHeader[0].Attributes.Add("rowspan","2");

    tcHeader.Add(new TableHeaderCell());
    tcHeader[1].Text = "星期";
    tcHeader[1].Attributes.Add("rowspan", "2");

    tcHeader.Add(new TableHeaderCell());
    tcHeader[2].Text = "白班";
    tcHeader[2].Attributes.Add("colspan", "2");

    tcHeader.Add(new TableHeaderCell());
    tcHeader[3].Text = "夜班</th></tr><tr>";
    tcHeader[3].Attributes.Add("colspan", "2");

    //第二行表头
    tcHeader.Add(new TableHeaderCell());
    tcHeader[4].Text = "姓名";

    tcHeader.Add(new TableHeaderCell());
    tcHeader[5].Text = "部门";

    tcHeader.Add(new TableHeaderCell());
    tcHeader[6].Text = "姓名";

    tcHeader.Add(new TableHeaderCell());
    tcHeader[7].Text = "部门";


    break;
    }
    }

  • 相关阅读:
    BTree和B+Tree详解
    python小技巧01递归解释内嵌
    Python实战171201筛选数据
    学术网站
    现代科技新闻
    人工智能——深度学习介绍
    时区缩写
    centos7忘记root密码
    centos7正确关机重启
    虚拟化漫谈
  • 原文地址:https://www.cnblogs.com/whwfwfy/p/4476284.html
Copyright © 2020-2023  润新知