ASP.NET SelectedItem 属性
![ListControl 控件参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)
定义和用法
SelectedItem 属性表示列表中选定项的文本。
实例
下面的实例获取 RadioButtonList 控件中的某个 ListItem 的文本:
<script runat="server">
Sub Change(obj As Object, e As EventArgs)
Response.Write("You selected " & rb1.SelectedItem.Text)
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("You selected " & rb1.SelectedItem.Text)
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 控件参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)