菜鸟学堂
在线运行
源代码
<HTML> <HEAD></HEAD> <FONT FACE="Verdana, Arial, Helvetica" SIZE=2> <FONT COLOR=#0000ff><script runat="server"><br>sub Page_Load<br>if Not Page.IsPostBack then<br> dim mycountries=New SortedList<br> mycountries.Add("N","Norway")<br> mycountries.Add("S","Sweden")<br> mycountries.Add("F","France")<br> mycountries.Add("I","Italy")<br> rb.DataSource=mycountries<br> rb.DataValueField="Key"<br> rb.DataTextField="Value"<br> rb.DataBind()<br>end if<br>end sub<br><br>sub displayMessage(s as Object,e As EventArgs)<br>lbl1.text="Your favorite country is: " & rb.SelectedItem.Text<br>end sub<br></script></FONT><br><br><!DOCTYPE html><br><html><br><body><br><br><form runat="server"><br><asp:RadioButtonList id="rb" runat="server"<br>AutoPostBack="True" onSelectedIndexChanged="displayMessage" /><br><p><asp:label id="lbl1" runat="server" /></p><br></form><br><br></body><br></html><br> </HTML>
运行结果
在线运行
菜鸟学堂 edu.jb51.net