看一下这个  http://www.fawcette.com/china/XmlFile.aspx?ID=237
根据这个方法肯定可以作出来

解决方案 »

  1.   

    这个贴子可以解决
    http://expert.csdn.net/Expert/topic/1469/1469433.xml?temp=.7259943
      

  2.   

    为什么不能用模版? 如果你坚持的话,总归有方法的,虽然是很笨的办法,譬如<%@ 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>