首页>教程>ASP.NET教程>ASP.NET TableRow 控件

需要支持?

如果通过文档没办法解决您的问题,请提交工单获取我们的支持!

ASP.NET TableRow 控件

内容纲要

ASP.NET TableRow 控件与 TableCell 控件和 Table 控件一起使用,来创建表格中的行

表格的行存储在 Table 控件中的 Rows 集合中

属性

属性描述.NET
Cells
HorizontalAlign表格行中内容的水平对齐方式1.0
TableSectionTable 控件中 TableRow 对象的位置2.0
VerticalAlign表格行中内容的垂直对齐方式1.0

ASP.NET TableRow HorizontalAlign 属性

ASP.NET TableRow HorizontalAlign 属性用于设置或返回 TableRow 控件中内容的水平对齐方式

语法

<asp:TableRow HorizontalAlign="align" runat="server">Some Content</asp:TableRow>
属性描述
align规定内容的水平对齐方式,默认为 NotSet

可能的值:
Center
Justify
Left
NotSet
Right

范例

下面的范例设置了 TableRow 控件的 HorizontalAlign 属性

<form runat="server">
<asp:Table id="tab1" runat="server">
<asp:TableRow HorizontalAlign="Right">
<asp:TableCell>Hello!</asp:TableCell>
<asp:TableCell>Hello!</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>

Web 控件标准属性

  • AccessKey
  • Attributes
  • BackColor
  • BorderColor
  • BorderStyle
  • BorderWidth
  • CssClass
  • Enabled
  • Font
  • EnableTheming
  • ForeColor
  • Height
  • IsEnabled
  • SkinID
  • Style
  • TabIndex
  • ToolTip
  • Width

如果想要访问完整描述,可以访问我们的 Web 控件标准属性

控件标准属性

  • AppRelativeTemplateSourceDirectory
  • BindingContainer
  • ClientID
  • Controls
  • EnableTheming
  • EnableViewState
  • ID
  • NamingContainer
  • Page
  • Parent
  • Site
  • TemplateControl
  • TemplateSourceDirectory
  • UniqueID
  • Visible

如果想要访问完整描述,可以访问我们的 控件标准属性

范例

Table

<!DOCTYPE html>
<meta charset="utf-8" />

<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>

范例中,我们声明了两个 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>
<meta charset="utf-8" />
<form runat="server">
<asp:Table id="Table1" BorderWidth="1" GridLines="Both" runat="server" />
</form>

范例中,我们声明了一个 Table 控件,三个 TableRow 控件,和两个 TableCell 控件

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
有新私信 私信列表
搜索