ASP.NET SelectedItemProperty


ListControl 控件参考手册ListControl Control Reference Manual

Definition and Usage

The SelectedItem property represents the text of the selected item in the list.


Example

The following example gets the text of a ListItem in the RadioButtonList control:

<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>

Show Example »

ListControl 控件参考手册ListControl Control Reference Manual Other Extensions