protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
this.style.display='none'; Codehighlighter1_79_2007_Open_Text.style.display='none'; Codehighlighter1_79_2007_Closed_Image.style.display='inline'; Codehighlighter1_79_2007_Closed_Text.style.display='inline';
}" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="" align="top">{
this.style.display='none'; Codehighlighter1_79_2007_Closed_Text.style.display='none'; Codehighlighter1_79_2007_Open_Image.style.display='inline'; Codehighlighter1_79_2007_Open_Text.style.display='inline';
}" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" alt="" align="top"> {
if (e.Row.RowType == DataControlRowType.Header)
{
this.style.display='none'; Codehighlighter1_145_2001_Open_Text.style.display='none'; Codehighlighter1_145_2001_Closed_Image.style.display='inline'; Codehighlighter1_145_2001_Closed_Text.style.display='inline';
}" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top">{
this.style.display='none'; Codehighlighter1_145_2001_Closed_Text.style.display='none'; Codehighlighter1_145_2001_Open_Image.style.display='inline'; Codehighlighter1_145_2001_Open_Text.style.display='inline';
}" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top"> {
//因為自訂表格頭,所以原來系統中實現的排序功能就失效了需自行實現排序功能
TableCellCollection myTcl = e.Row.Cells;
//清除自動產生的表頭
myTcl.Clear();
//添加新的表頭
Label l1 = new Label();
l1.Text = "序號";
myTcl[0].Controls.Add(l1);
myTcl.Add(new TableHeaderCell());
myTcl[1].RowSpan = 2;
myTcl[1].Text = "進口料件</br>品名";
myTcl[1].Width = 150;
myTcl.Add(new TableHeaderCell());
myTcl[2].ColumnSpan = 2;
myTcl[2].Text = "成品1";
myTcl.Add(new TableHeaderCell());
myTcl[3].ColumnSpan = 2;
myTcl[3].Text = "成品2";
myTcl.Add(new TableHeaderCell());
myTcl[4].ColumnSpan = 2;
myTcl[4].Text = "成品3";
myTcl.Add(new TableHeaderCell());
myTcl[5].ColumnSpan = 2;
myTcl[5].Text = "成品4";
myTcl.Add(new TableHeaderCell());
myTcl[6].ColumnSpan = 2;
myTcl[6].Text = "成品5";
myTcl.Add(new TableHeaderCell());
myTcl[7].ColumnSpan = 2;
myTcl[7].Text = "成品6";
myTcl.Add(new TableHeaderCell());
myTcl[8].ColumnSpan = 2;
myTcl[8].Text = "成品7";
myTcl.Add(new TableHeaderCell());
myTcl[9].ColumnSpan = 2;
myTcl[9].Text = "成品8";
myTcl.Add(new TableHeaderCell());
myTcl[10].RowSpan = 2;
myTcl[10].Text = "操作";
//以下為新增第二列名,原理有些類似於SQL注入攻擊
myTcl.Add(new TableHeaderCell());
myTcl[11].ColumnSpan = 1;
myTcl[11].Text = "<tr><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th><th>單耗</th><th>損耗</th>";
}
}