GridView双层表头

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

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";
}
}
}。

相关文档
最新文档