不用模版能做出如下多表头效果,我愿出300分 看一下这个 http://www.fawcette.com/china/XmlFile.aspx?ID=237根据这个方法肯定可以作出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个贴子可以解决http://expert.csdn.net/Expert/topic/1469/1469433.xml?temp=.7259943 为什么不能用模版? 如果你坚持的话,总归有方法的,虽然是很笨的办法,譬如<%@ Import Namespace="System.Data" %><script language="C#" runat="server">DataTable LoadData(){ DataTable dt = new DataTable(); for (int i=1; i <= 5; i++) dt.Columns.Add("Column"+i.ToString()); for (int i=0; i < 10; i++) { DataRow dr = dt.NewRow(); for (int j=0; j <5; j++) dr[j] = "字段"+(j+1).ToString(); dt.Rows.Add(dr); } return dt;}Table CreateTable(DataTable dt){ System.Diagnostics.Debug.Assert(dt.Columns.Count >=5); Table t = new Table(); t.Width = Unit.Pixel(382); t.CellPadding = 0; t.CellSpacing = 0; t.BorderWidth = Unit.Pixel(2); t.GridLines = GridLines.Both; foreach (DataRow dr in dt.Rows) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); tc.Width = Unit.Pixel(115); tc.RowSpan = 3; tc.Text = dr[0].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Height = Unit.Pixel(41); tc.ColumnSpan = 4; tc.VerticalAlign = VerticalAlign.Top; tc.Text = "类型"; tr.Cells.Add(tc); t.Rows.Add(tr); tr = new TableRow(); tc = new TableCell(); tc.Height = Unit.Pixel(42); tc.ColumnSpan = 2; tc.VerticalAlign = VerticalAlign.Top; tc.Text = "类型1"; tr.Cells.Add(tc); tc = new TableCell(); tc.ColumnSpan = 4; tc.VerticalAlign = VerticalAlign.Top; tc.Text = "类型2"; tr.Cells.Add(tc); t.Rows.Add(tr); tr = new TableRow(); tc = new TableCell(); tc.Width = Unit.Pixel(52); tc.Height = Unit.Pixel(75); tc.VerticalAlign = VerticalAlign.Top; tc.Text = dr[1].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Width = Unit.Pixel(74); tc.VerticalAlign = VerticalAlign.Top; tc.Text = dr[2].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Width = Unit.Pixel(66); tc.VerticalAlign = VerticalAlign.Top; tc.Text = dr[3].ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Width = Unit.Pixel(75); tc.VerticalAlign = VerticalAlign.Top; tc.Text = dr[4].ToString(); tr.Cells.Add(tc); t.Rows.Add(tr); } return t;}void Page_Load(Object o, EventArgs e){ if (!IsPostBack) { DataTable dt = LoadData(); Table t = CreateTable(dt); form1.Controls.Add(t); }}</script><form runat="server" id="form1"></form> 一个小问题 如何不让iframe完全遮住DropDownList 用FREETEXTBOX出现的问题,不能上传!!在线等! ASP.NET的程序,运行后报错,哪位大虾给指导一下? 一个关HTMLInputFile控件的问题 调试一次后,再点击任何按钮都跳转到上一界面,奇怪! .Net写的Winform程序,运行一段时间就停止了,高分求教。 大家评评,有理不 aspnetmenu问题 有一问题 后面地 : System.Web.UI.Page 表示什么意思? 帮忙看一下这个程序那里有问题?
http://expert.csdn.net/Expert/topic/1469/1469433.xml?temp=.7259943
<script language="C#" runat="server">
DataTable LoadData()
{
DataTable dt = new DataTable();
for (int i=1; i <= 5; i++)
dt.Columns.Add("Column"+i.ToString()); for (int i=0; i < 10; i++)
{
DataRow dr = dt.NewRow();
for (int j=0; j <5; j++)
dr[j] = "字段"+(j+1).ToString();
dt.Rows.Add(dr);
} return dt;
}Table CreateTable(DataTable dt)
{
System.Diagnostics.Debug.Assert(dt.Columns.Count >=5); Table t = new Table();
t.Width = Unit.Pixel(382);
t.CellPadding = 0;
t.CellSpacing = 0;
t.BorderWidth = Unit.Pixel(2);
t.GridLines = GridLines.Both;
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow(); TableCell tc = new TableCell();
tc.Width = Unit.Pixel(115);
tc.RowSpan = 3;
tc.Text = dr[0].ToString();
tr.Cells.Add(tc); tc = new TableCell();
tc.Height = Unit.Pixel(41);
tc.ColumnSpan = 4;
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = "类型";
tr.Cells.Add(tc); t.Rows.Add(tr); tr = new TableRow(); tc = new TableCell();
tc.Height = Unit.Pixel(42);
tc.ColumnSpan = 2;
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = "类型1";
tr.Cells.Add(tc); tc = new TableCell();
tc.ColumnSpan = 4;
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = "类型2";
tr.Cells.Add(tc); t.Rows.Add(tr); tr = new TableRow(); tc = new TableCell();
tc.Width = Unit.Pixel(52);
tc.Height = Unit.Pixel(75);
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = dr[1].ToString();
tr.Cells.Add(tc);
tc = new TableCell();
tc.Width = Unit.Pixel(74);
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = dr[2].ToString();
tr.Cells.Add(tc); tc = new TableCell();
tc.Width = Unit.Pixel(66);
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = dr[3].ToString();
tr.Cells.Add(tc); tc = new TableCell();
tc.Width = Unit.Pixel(75);
tc.VerticalAlign = VerticalAlign.Top;
tc.Text = dr[4].ToString();
tr.Cells.Add(tc); t.Rows.Add(tr);
} return t;
}void Page_Load(Object o, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = LoadData();
Table t = CreateTable(dt);
form1.Controls.Add(t);
}
}
</script>
<form runat="server" id="form1">
</form>