?
本文檔使用 php中文網(wǎng)手冊(cè) 發(fā)布
TableRow 控件與 TableCell 控件和 Table 控件一起使用,來(lái)創(chuàng)建表格中的行。
提示:表格的行存儲(chǔ)在 Table 控件中的 Rows 集合中。
屬性 | 描述 | .NET |
---|---|---|
Cells | ||
HorizontalAlign | 表格行中內(nèi)容的水平對(duì)齊方式。 | 1.0 |
TableSection | Table 控件中 TableRow 對(duì)象的位置。 | 2.0 |
VerticalAlign | 表格行中內(nèi)容的垂直對(duì)齊方式。 | 1.0 |
AccessKey,?Attributes,?BackColor,?BorderColor,?BorderStyle,?BorderWidth,?CssClass,?Enabled,?Font,?EnableTheming,?ForeColor,?Height,?IsEnabled,?SkinID,?Style,?TabIndex,?ToolTip,?Width
AppRelativeTemplateSourceDirectory,?BindingContainer,?ClientID,?Controls,?EnableTheming,?EnableViewState,?ID,?NamingContainer,?Page,?Parent,?Site,?TemplateControl,?TemplateSourceDirectory,?UniqueID,?Visible
Table
<!DOCTYPE?html> <html> <body> <form?runat=server> <asp:Table?runat="server"?CellPadding="5" GridLines="horizontal"?HorizontalAlign="Center"> ???<asp:TableRow> ?????<asp:TableCell>1</asp:TableCell> ?????<asp:TableCell>2</asp:TableCell> ???</asp:TableRow> ???<asp:TableRow> ?????<asp:TableCell>3</asp:TableCell> ?????<asp:TableCell>4</asp:TableCell> ???</asp:TableRow> </asp:Table> <br> <asp:Table?runat="server"?CellPadding="5" GridLines="vertical"?HorizontalAlign="Center"> ???<asp:TableRow> ?????<asp:TableCell>1</asp:TableCell> ?????<asp:TableCell>2</asp:TableCell> ???</asp:TableRow> ???<asp:TableRow> ?????<asp:TableCell>3</asp:TableCell> ?????<asp:TableCell>4</asp:TableCell> ???</asp:TableRow> </asp:Table> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了兩個(gè) Table 控件。
Table 2
<script??runat="server"> Sub?Page_Load(sender?As?Object,?e?As?EventArgs) dim?rows,cells,j,i rows=3 cells=2 For?j=0?To?rows-1 ???dim?r?As?New?TableRow() ???For?i=0?To?cells-1 ?????dim?c?As?New?TableCell() ?????c.Controls.Add(New?LiteralControl("row?"?&?j?&?",?cell?"?&?i)) ?????r.Cells.Add(c) ???Next ???Table1.Rows.Add(r) Next End?Sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> <asp:Table?id="Table1"?BorderWidth="1"?GridLines="Both"?runat="server"?/> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了一個(gè) Table 控件,三個(gè) TableRow 控件,和兩個(gè) TableCell 控件。