ASP.NET SelectedIndex 屬性

定義和用法
SelectedIndex 屬性表示列表中選定項的序號索引。
實例
下麵的實例獲取 RadioButtonList 控件中的某個 ListItem 的索引:
<script runat="server">
Sub Change(obj As Object, e As EventArgs)
Response.Write("Selected index: " & rb1.SelectedIndex)
End Sub
</script>
<form runat=server>
<asp:RadioButtonList id="rb1" AutoPostBack="true"
runat="server" OnSelectedIndexChanged="Change">
<asp:ListItem Text="Item 1" />
<asp:ListItem Text="Item 2" />
</asp:RadioButtonList>
</form>
Sub Change(obj As Object, e As EventArgs)
Response.Write("Selected index: " & rb1.SelectedIndex)
End Sub
</script>
<form runat=server>
<asp:RadioButtonList id="rb1" AutoPostBack="true"
runat="server" OnSelectedIndexChanged="Change">
<asp:ListItem Text="Item 1" />
<asp:ListItem Text="Item 2" />
</asp:RadioButtonList>
</form>
