WebPartZoneCollection.IndexOf(WebPartZoneBase) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回集合特定成員的位置。
public:
int IndexOf(System::Web::UI::WebControls::WebParts::WebPartZoneBase ^ value);
public int IndexOf (System.Web.UI.WebControls.WebParts.WebPartZoneBase value);
member this.IndexOf : System.Web.UI.WebControls.WebParts.WebPartZoneBase -> int
Public Function IndexOf (value As WebPartZoneBase) As Integer
參數
- value
- WebPartZoneBase
WebPartZoneBase,為集合成員。
傳回
整數,表示集合中特定物件的位置。
範例
下列程式碼範例示範 如何使用 IndexOf 方法。 範例的完整程式碼,包括使用者控制項、包含區域的頁面,以及包含程式碼的部分類別檔案,可在類別概觀的 WebPartZoneCollection Example 區段中找到。
下列程式碼區段示範 方法的使用 IndexOf 方式。 若要執行程式碼,請在瀏覽器中載入頁面,然後按一下 [WebPartZone1 索引 ] 按鈕。
protected void Button4_Click(object sender, EventArgs e)
{
Label1.Text = String.Empty;
Label1.Text = "WebPartZone1 index: " + mgr.Zones.IndexOf(WebPartZone1);
}
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs)
Label1.Text = String.Empty
Label1.Text = "WebPartZone1 index: " & mgr.Zones.IndexOf(WebPartZone1)
End Sub
備註
如果您在網頁元件頁面上有多個 WebPartZone 區域,而且您必須知道一個區域相對於其他區域的序數位置,此方法 IndexOf 會很有用。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應