簡體   English   中英

如何設置表格的寬度?

[英]How to set the width of a Table?

Table table = new Table ();        
TableRow row1 = new TableRow();
TableRow row2 = new TableRow();
TableCell cell1_1 = new TableCell { RowSpan = 2,  };           
TableCell cell1_2 = new TableCell
{
    Text = string.Format("<h4>{0}</h4><br />{1}<br/>",
        product.ProductName, "Product No:" + product.Id),
    HorizontalAlign = HorizontalAlign.Left,
};
TableCell cell1_3 = new TableCell { Text = "Unit Price<hr/>"};  
TableCell cell1_4 = new TableCell { Text = "Quantity<hr/>" };            
TableCell cell1_5 = new TableCell { Text = "Product Total<hr/>"};
TableCell cell1_6 = new TableCell();
TableCell cell2_1 = new TableCell();
TableCell cell2_2 = new TableCell { Text = "Rs " + product.Price};
TableCell cell2_3 = new TableCell();            
TableCell cell2_4 = new TableCell { Text = "Rs " + (order.Quantity * product.Price) };
TableCell cell2_5 = new TableCell();

如何設置這張桌子的寬度? 當我嘗試table.Witdh不能正常工作時

Table table = new Table();
table.Width=new Unit("100%");

要么

 table.Width = new Unit("70px");

其中Unit屬於System.Web.UI.WebControls

table.Width =新單位(“ 25%”)

為我工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM