<table id="table1" cellSpacing="0" rules="all" border="1" <tr>
<tr>
<td align="middle" rowSpan="2">書籍編號</td>
<th rowSpan="2">書籍名稱</th>
<th colSpan="2">定價機制</th>
</tr>
<tr>
<th>進價成本</th>
<th>銷售價格</th>
</tr>
<tr>
<td>1</td>
<td>Good More</td>
<td>38</td>
<td>40</td>
</tr>
<tr>
<td>2</td>
<td>Good Better</td>
<td>55</td>
<td>60</td>
</tr>
<tr>
<td>3</td>
<td>Good Peace</td>
<td>25</td>
<td>30</td>
</tr>
</table>
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Header)
{
TableCellCollection tcl=e.Item.Cells;
tcl.Clear();
tcl.Add(new TableCell());
tcl[0].Attributes["align"]="center";
tcl[0].RowSpan=2;
tcl[0].Text="書籍編號";
tcl.Add(new TableHeaderCell());
tcl[1].RowSpan=2;
tcl[1].Text="書籍名稱";
tcl.Add(new TableHeaderCell());
tcl[2].ColumnSpan=2;
tcl[2].Text="定價機制</th></tr><tr><th>進價成本</th><th>銷售價格";
}
}
沒有留言:
張貼留言