共用方式為


SelectionList.SelectedIndex 屬性

定義

傳回選取項目的索引。 預設值為 -1。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

public:
 property int SelectedIndex { int get(); void set(int value); };
[System.ComponentModel.Bindable(false)]
[System.ComponentModel.Browsable(false)]
public int SelectedIndex { get; set; }
[<System.ComponentModel.Bindable(false)>]
[<System.ComponentModel.Browsable(false)>]
member this.SelectedIndex : int with get, set
Public Property SelectedIndex As Integer

屬性值

選取之項目的索引。

屬性

例外狀況

嘗試將 SelectedIndex 屬性設為小於 -1,或是大於或等於項目數的值。

備註

如果控件處於多個選取模式,這個屬性會傳回第一個選取專案的索引。 選取的索引無法以宣告方式設定; Selected 請改用清單項目的屬性。 SelectedIndex將設定為 -1 以清除選取範圍。 當您想要從清單中動態移除專案時,這會很有用。

適用於

另請參閱