我不知道你的代码是怎么写的
我想应该不会有这种情况,以下是我写的 Table tbl = new Table();
TableRow row = new TableRow();
tbl.BorderWidth=1;
for (int i=0;i<10;i++)
{
row.Cells.Add(new TableCell());
row.Cells[i].Text ="?ń"+i;
}
tbl.Rows.Add(row);

this.PlaceHolder1.Controls.Add(tbl);

解决方案 »

  1.   

    Table tb=new Table();
    try
    {
      tb.Attributes.Remove("style");
      tb.Atrributes.Add("style","border-style:None;width:940px;word-break:break-all; word-wrap: break-word;");
    }
    catch(Exception ex)
    {
      throw(ex); 
    }
      

  2.   

    动态添加表格行Function AddRow(ByVal i, ByVal tr1)        Dim td1 As New TableCell()
            Dim td2 As New TableCell()
            Table2.CellPadding = 0
            Table2.CellSpacing = 0        tr1.BackColor = Color.LightGray        td1.HorizontalAlign = HorizontalAlign.Center
            td2.HorizontalAlign = HorizontalAlign.Center
            td1.VerticalAlign = VerticalAlign.Middle
            td1.BorderColor = Color.Black
            td2.BorderColor = Color.Black        td1.BorderWidth = Unit.Pixel(1)
            td2.BorderWidth = Unit.Pixel(1)        Dim txtXx As New TextBox()
            txtXx.Width = Unit.Pixel(50)
            txtXx.ID = "xx" + i.ToString()
            td1.Text = "option" + i.ToString()
            td2.Controls.Add(txtXx)        tr1.Cells.Add(td1)
            tr1.Cells.Add(td2)        Table2.Rows.Add(tr1)    End Function
        Function addrow2(ByVal i)
            Dim txtXx As New TextBox()
            txtXx.Width = Unit.Pixel(10)
            txtXx.ID = "xx" + i.ToString()
            Page.Controls.Add(txtXx)
        End Function
        Function add3(ByVal tr As TableRow)
            Dim txtXx As New TextBox()
            txtXx.Width = Unit.Pixel(100)
            txtXx.ID = "xx" + i.ToString()
            txtXx.Text = "option" + i.ToString()        Dim td As New TableCell()
            td.Controls.Add(txtXx)
            tr.Cells.Add(td)
            Table2.Rows.Add(tr)
        End Function
      

  3.   

    我不知道我这里错在那里即使我用了这样的写法
    td1.BorderWidth = Unit.Pixel(1)输出的语句是这样的:<table id="tbShip" cellspacing="0" border="0" style="border-width:1px;border-style:solid;width:960px;border-collapse:collapse;">效果反映在style="border-width:1px;"这里但是还是有border="0"这样的代码输出,怎么回事哪?
      

  4.   

    cellSpacing 为什么把这个属性设置成0的时候,就会自动输出border-collapse:collapse?
      

  5.   

    我也遇到同样的问题,代码和楼上的一样,但输出时会有border="0",这一段,期待能解决!
      

  6.   

    即使用了二楼的方法border-collapse:collapse这个语句还是会输出会写在一起,好像
    cellSpacing 设置成0的时候,就会自动输出border-collapse:collapse
      

  7.   

    border="0" style="border-color:Black;border-width:1px;border-style:solid;width:100%;"为什么我设置了Border为1,但输出结果还是如上,用Table1.Attributes.Remove("border");还是不行啊。
    Table1.BorderWidth = Unit.Pixel(1);
      

  8.   

    Page对象加载的时候,事件有一个执行顺序,楼主是在什么时候创建表格的?
      

  9.   

    我是在一个按钮的click时间里画表格的