ASP.NET SelectedIndex属性
ListControl 控件参考手册
定義と用法
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>
演示实例 »
ListControl 控件参考手册 其他扩展