RepeaterItemCollection(ArrayList) 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 RepeaterItemCollection 類別的新執行個體。
public:
RepeaterItemCollection(System::Collections::ArrayList ^ items);
public RepeaterItemCollection (System.Collections.ArrayList items);
new System.Web.UI.WebControls.RepeaterItemCollection : System.Collections.ArrayList -> System.Web.UI.WebControls.RepeaterItemCollection
Public Sub New (items As ArrayList)
參數
範例
void Page_Load(Object Sender, EventArgs e)
{
if (!IsPostBack)
{
ArrayList myDataSource = new ArrayList();
myDataSource.Add(new PositionData("Item 1", "$6.00"));
myDataSource.Add(new PositionData("Item 2", "$7.48"));
myDataSource.Add(new PositionData("Item 3", "$9.96"));
// Initialize the RepeaterItemCollection using the ArrayList as the data source.
RepeaterItemCollection myCollection = new RepeaterItemCollection(myDataSource);
myRepeater.DataSource = myCollection;
myRepeater.DataBind();
}
}
Sub Page_Load(Sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim myDataSource As New ArrayList()
myDataSource.Add(New PositionData("Item 1", "$6.00"))
myDataSource.Add(New PositionData("Item 2", "$7.48"))
myDataSource.Add(New PositionData("Item 3", "$9.96"))
' Initialize the RepeaterItemCollection using the ArrayList as the data source.
Dim myCollection As New RepeaterItemCollection(myDataSource)
myRepeater.DataSource = myCollection
myRepeater.DataBind()
End If
End Sub 'Page_Load
備註
使用此建構函式來建立和初始化 類別的新實例 RepeaterItemCollection 。