62,254
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TableItemStyle tablestyle = new TableItemStyle();
tablestyle.HorizontalAlign = HorizontalAlign.Center;
tablestyle.VerticalAlign = VerticalAlign.Middle;
tablestyle.Width = Unit.Pixel(100);
for (int i = 2; i < 10; i++)
{
TableRow temprow = new TableRow();
for (int j = 0; j < 3; j++)
{
TableCell tempcell = new TableCell();
tempcell.Text = "(" + i + "," + j + ")";
temprow.Cells.Add(tempcell);
}
Table1.Rows.Add(temprow);
}
foreach (TableRow r in Table1.Rows)
foreach (TableCell c in r.Cells)
c.ApplyStyle(tablestyle);
TableHeaderCell header = new TableHeaderCell();
header.RowSpan = 1;
header.ColumnSpan = 3;
header.Text = "表明(X,Y)值的表格";
header.Font.Bold = true;
header.BackColor = Color.Red;
header.HorizontalAlign = HorizontalAlign.Center;
header.VerticalAlign = VerticalAlign.Top;
TableRow headerRow = new TableRow();
headerRow.Cells.Add(header);
Table1.Rows.AddAt(0, headerRow);
}
}
TableHeaderCell header = new TableHeaderCell();
//这里不是定义了表头么?