<%@ Page Language="c#" %>
<script runat="server">
void Page_Load()
{
if (Page.IsPostBack)
{
Message.Text = "You have selected the following: " +
radio1.SelectedItem.Value;
}
}
</script>
<html>
<head>
<title>Radio Button List Example</title>
</head>
<body>
<asp:Label id="Message" runat="server"></asp:Label>
<br />
<br />
Which city do you wish to look at hotels for?
<br />
<br />
<form runat="server">
<asp:radiobuttonlist id="radio1" runat="server">
<asp:listitem id="option1" runat="server" value="Madrid" />
<asp:listitem id="option2" runat="server" value="Oslo" />
<asp:listitem id="option3" runat="server" value="Lisbon" />
</asp:radiobuttonlist>
<br />
<br />
<input type="submit" value="提交查询内容" />
</form>
</body>
</html>
<script runat="server">
void Page_Load()
{
if (Page.IsPostBack)
{
Message.Text = "You have selected the following: " +
radio1.SelectedItem.Value;
}
}
</script>
<html>
<head>
<title>Radio Button List Example</title>
</head>
<body>
<asp:Label id="Message" runat="server"></asp:Label>
<br />
<br />
Which city do you wish to look at hotels for?
<br />
<br />
<form runat="server">
<asp:radiobuttonlist id="radio1" runat="server">
<asp:listitem id="option1" runat="server" value="Madrid" />
<asp:listitem id="option2" runat="server" value="Oslo" />
<asp:listitem id="option3" runat="server" value="Lisbon" />
</asp:radiobuttonlist>
<br />
<br />
<input type="submit" value="提交查询内容" />
</form>
</body>
</html>
此博客展示了一个ASP.NET的单选按钮列表示例。使用C#语言,在页面加载时判断是否为回发,若为回发则显示所选选项的值。页面包含一个单选按钮列表,提供马德里、奥斯陆、里斯本三个选项,还有一个提交按钮用于提交查询内容。
1147

被折叠的 条评论
为什么被折叠?



