Latest web development tutorials

ASP.NET SelectedItem property

ListControl control Reference Manual ListControl control Reference Manual

Definition and Usage

SelectedItem property represents the text items selected in the list.


Examples

The following examples get a RadioButtonList ListItem text in the control of:

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

The demonstration >>

ListControl control Reference Manual ListControl control Reference Manual