ASP.NET SelectedValue 属性
最后更新于:2022-03-26 23:27:41
ASP.NET SelectedValue 属性
定义和用法
SelectedValue 属性表示列表中选定项的值。
实例
下面的实例获取 RadioButtonList 控件中的某个 ListItem 的值:
<script runat=”server”>
Sub Change(obj As Object, e As EventArgs)
Response.Write(“You selected ” & rb1.SelectedValue)
End Sub
</script>
Sub Change(obj As Object, e As EventArgs)
Response.Write(“You selected ” & rb1.SelectedValue)
End Sub
</script>
<form runat=server>
<asp:RadioButtonList id=”rb1″ AutoPostBack=”true”
runat=”server” OnSelectedIndexChanged=”Change”>
<asp:ListItem Value=”Item 1″ />
<asp:ListItem Value=”Item 2″ />
</asp:RadioButtonList>
</form>