TableHeaderCell.Scope 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
呈现 TableHeaderCell 控件时,获取或设置其范围。
public:
virtual property System::Web::UI::WebControls::TableHeaderScope Scope { System::Web::UI::WebControls::TableHeaderScope get(); void set(System::Web::UI::WebControls::TableHeaderScope value); };
public virtual System.Web.UI.WebControls.TableHeaderScope Scope { get; set; }
member this.Scope : System.Web.UI.WebControls.TableHeaderScope with get, set
Public Overridable Property Scope As TableHeaderScope
属性值
一个 TableHeaderScope 值。 默认值为 NotSet。
示例
下面的代码示例演示如何以声明方式对 Scope 属性进行编程。 请注意 属性 AssociatedHeaderCellID 的使用。
<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>TableHeaderCell Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>TableHeaderCell Example</h1>
<asp:table id="Table1" runat="server"
CellPadding="3"
CellSpacing="3"
BorderWidth="1"
GridLines="Both">
<asp:TableHeaderRow ID="TableHeaderRow1" runat="server">
<asp:TableHeaderCell runat="server"
ID="Column1Header"
CategoryText="Column1"
AbbreviatedText="Header 1"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 1 Header
</asp:TableHeaderCell>
<asp:TableHeaderCell runat="server"
ID="Column2Header"
CategoryText="Column2,Column2Alternative"
AbbreviatedText="Header 2"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 2 Header
</asp:TableHeaderCell>
<asp:TableHeaderCell runat="server"
ID="Column3Header"
CategoryText="Column3"
AbbreviatedText="Header 3"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 3 Header
</asp:TableHeaderCell>
</asp:TableHeaderRow>
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell AssociatedHeaderCellID="Column1Header"
HorizontalAlign="Left">
(0,0)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column2Header">
(0,1)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column3Header">
(0,2)
</asp:TableCell>
</asp:TableRow>
<asp:TableRow
HorizontalAlign="Center">
<asp:TableCell
AssociatedHeaderCellID="Column1Header"
HorizontalAlign="Left">
(1,0)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column2Header">
(1,1)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column3Header">
(1,2)
</asp:TableCell>
</asp:TableRow>
<asp:TableRow
HorizontalAlign="Center">
<asp:TableCell
AssociatedHeaderCellID=
"Column1Header,Column2Header,Column3Header"
ColumnSpan="3"
HorizontalAlign="Left">
(2,0)
</asp:TableCell>
</asp:TableRow>
</asp:table>
</div>
</form>
</body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>TableHeaderCell Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>TableHeaderCell Example</h1>
<asp:table id="Table1" runat="server"
CellPadding="3"
CellSpacing="3"
BorderWidth="1"
GridLines="Both">
<asp:TableHeaderRow ID="TableHeaderRow1" runat="server">
<asp:TableHeaderCell runat="server"
ID="Column1Header"
CategoryText="Column1"
AbbreviatedText="Header 1"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 1 Header
</asp:TableHeaderCell>
<asp:TableHeaderCell runat="server"
ID="Column2Header"
CategoryText="Column2,Column2Alternative"
AbbreviatedText="Header 2"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 2 Header
</asp:TableHeaderCell>
<asp:TableHeaderCell runat="server"
ID="Column3Header"
CategoryText="Column3"
AbbreviatedText="Header 3"
Scope="Column"
HorizontalAlign="Center"
VerticalAlign="Middle"
BackColor="LightGray">
Column 3 Header
</asp:TableHeaderCell>
</asp:TableHeaderRow>
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell AssociatedHeaderCellID="Column1Header"
HorizontalAlign="Left">
(0,0)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column2Header">
(0,1)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column3Header">
(0,2)
</asp:TableCell>
</asp:TableRow>
<asp:TableRow
HorizontalAlign="Center">
<asp:TableCell
AssociatedHeaderCellID="Column1Header"
HorizontalAlign="Left">
(1,0)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column2Header">
(1,1)
</asp:TableCell>
<asp:TableCell
AssociatedHeaderCellID="Column3Header">
(1,2)
</asp:TableCell>
</asp:TableRow>
<asp:TableRow
HorizontalAlign="Center">
<asp:TableCell
AssociatedHeaderCellID=
"Column1Header,Column2Header,Column3Header"
ColumnSpan="3"
HorizontalAlign="Left">
(2,0)
</asp:TableCell>
</asp:TableRow>
</asp:table>
</div>
</form>
</body>
</html>
注解
在呈现控件时, Scope 使用 属性获取或设置控件的范围 TableHeaderCell 。 的 TableHeaderCell 作用域表示标头应用于的单元格。 对于复杂表,请使用 AssociatedHeaderCellID 属性,该属性提供对标题单元格与数据单元格关系的规范的更多控制。 属性 Scope 用于通过提供有关单元格和标头之间的关系的信息,使 HTML 表更易于访问。
有关可用表标头范围的列表,请参阅 TableHeaderScope。
此属性的值存储在视图状态中。