HtmlTable.HtmlTableRowControlCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
HtmlTableRow コントロールの行であるHtmlTable オブジェクトのコレクションを表します。
protected: ref class HtmlTable::HtmlTableRowControlCollection : System::Web::UI::ControlCollection
protected class HtmlTable.HtmlTableRowControlCollection : System.Web.UI.ControlCollection
Protected Class HtmlTable.HtmlTableRowControlCollection
Inherits ControlCollection
- 継承
例
次のコード例では、Add メソッドをオーバーライドするカスタム HtmlTable.HtmlTableRowControlCollectionを作成して、行がテーブルに追加されたときに、常にテーブルの行コレクションの先頭に追加されるようにする方法を示します。
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<!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>
<title>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</title>
</head>
<body>
<form id="Form1"
method="post"
runat="server">
<h3>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</h3>
<aspSample:CustomHtmlTableRowControlCollection
id="HtmlTable1"
name="HtmlTable1"
runat="server"
border="1"
cellSpacing="0"
cellPadding="5">
<tr>
<td>1,1</td>
<td>1,2</td>
<td>1,3</td>
</tr>
<tr>
<td>2,1</td>
<td>2,2</td>
<td>2,3</td>
</tr>
<tr>
<td>3,1</td>
<td>3,2</td>
<td>3,3</td>
</tr>
</aspSample:CustomHtmlTableRowControlCollection>
</form>
</body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!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>
<title>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</title>
</head>
<body>
<form id="Form1"
method="post"
runat="server">
<h3>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</h3>
<aspSample:CustomHtmlTableRowControlCollection
id="HtmlTable1"
name="HtmlTable1"
runat="server"
border="1"
cellSpacing="0"
cellPadding="5">
<tr>
<td>1,1</td>
<td>1,2</td>
<td>1,3</td>
</tr>
<tr>
<td>2,1</td>
<td>2,2</td>
<td>2,3</td>
</tr>
<tr>
<td>3,1</td>
<td>3,2</td>
<td>3,3</td>
</tr>
</aspSample:CustomHtmlTableRowControlCollection>
</form>
</body>
</html>
using System.Web;
using System.Web.UI;
using System.Security.Permissions;
namespace Samples.AspNet.CS.Controls
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CustomHtmlTableRowControlCollection : System.Web.UI.HtmlControls.HtmlTable
{
protected override ControlCollection CreateControlCollection()
{
return new MyHtmlTableRowControlCollection(this);
}
protected class MyHtmlTableRowControlCollection : ControlCollection
{
internal MyHtmlTableRowControlCollection(Control owner) : base(owner) { }
public override void Add(Control child)
{
// Always add new rows at the top of the table.
base.AddAt(0, child);
}
}
}
}
Imports System.Web
Imports System.Web.UI
Imports System.Security.Permissions
Namespace Samples.AspNet.VB.Controls
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class CustomHtmlTableRowControlCollection
Inherits System.Web.UI.HtmlControls.HtmlTable
Protected Overrides Function CreateControlCollection() As System.Web.UI.ControlCollection
Return New MyHtmlTableRowControlCollection(Me)
End Function
Protected Class MyHtmlTableRowControlCollection
Inherits ControlCollection
Friend Sub New(ByVal owner As Control)
MyBase.New(owner)
End Sub
Public Overrides Sub Add(ByVal child As Control)
' Always add new rows at the top of the table.
MyBase.AddAt(0, child)
End Sub
End Class
End Class
End Namespace
注釈
HtmlTable.HtmlTableRowControlCollection クラスは、HtmlTable コントロールのHtmlTableRow オブジェクトのコレクションを表します。 コントロールは、 Add メソッドを使用してコレクションの末尾に追加することも、 AddAt メソッドを使用してコレクション内の指定したインデックス位置に追加することもできます。 HtmlTable.HtmlTableRowControlCollection コレクションに追加できるのは、HtmlTableRow型のコントロールだけです。
プロパティ
| 名前 | 説明 |
|---|---|
| Count |
指定した ASP.NET サーバー コントロールの ControlCollection オブジェクト内のサーバー コントロールの数を取得します。 (継承元 ControlCollection) |
| IsReadOnly |
ControlCollection オブジェクトが読み取り専用かどうかを示す値を取得します。 (継承元 ControlCollection) |
| IsSynchronized |
ControlCollection オブジェクトが同期されているかどうかを示す値を取得します。 (継承元 ControlCollection) |
| Item[Int32] |
ControlCollection オブジェクト内の指定したインデックス位置にあるサーバー コントロールへの参照を取得します。 (継承元 ControlCollection) |
| Owner |
ControlCollection オブジェクトが属する ASP.NET サーバー コントロールを取得します。 (継承元 ControlCollection) |
| SyncRoot |
コントロールのコレクションへのアクセスを同期するために使用できるオブジェクトを取得します。 (継承元 ControlCollection) |
メソッド
| 名前 | 説明 |
|---|---|
| Add(Control) |
指定した Control オブジェクトをコレクションに追加します。 |
| AddAt(Int32, Control) |
指定した Control オブジェクトをコレクションに追加します。 新しいコントロールが、指定したインデックス位置にある配列に追加されます。 |
| Clear() |
現在のサーバー コントロールの ControlCollection オブジェクトからすべてのコントロールを削除します。 (継承元 ControlCollection) |
| Contains(Control) |
指定したサーバー コントロールが親サーバー コントロールの ControlCollection オブジェクト内にあるかどうかを判断します。 (継承元 ControlCollection) |
| CopyTo(Array, Int32) |
ControlCollection内の指定したインデックス位置から、Array オブジェクトに格納されている子コントロールをArray オブジェクトにコピーします。 (継承元 ControlCollection) |
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetEnumerator() |
ControlCollection オブジェクトを反復処理できる列挙子を取得します。 (継承元 ControlCollection) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IndexOf(Control) |
コレクション内の指定した Control オブジェクトのインデックスを取得します。 (継承元 ControlCollection) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| Remove(Control) |
指定したサーバー コントロールを親サーバー コントロールの ControlCollection オブジェクトから削除します。 (継承元 ControlCollection) |
| RemoveAt(Int32) |
指定したインデックス位置にある子コントロールを ControlCollection オブジェクトから削除します。 (継承元 ControlCollection) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
拡張メソッド
| 名前 | 説明 |
|---|---|
| AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
| AsQueryable(IEnumerable) |
IEnumerable を IQueryableに変換します。 |
| Cast<TResult>(IEnumerable) |
IEnumerable の要素を指定した型にキャストします。 |
| OfType<TResult>(IEnumerable) |
指定した型に基づいて、IEnumerable の要素をフィルター処理します。 |