checkboxlist
代码:
<script runat="server">Sub Check(sender As Object, e As EventArgs)
dim i
mess.Text="<p>Selected Item(s):</p>"
for i=0 to check1.Items.Count-1
if check1.Items(i).Selected then
mess.Text+=check1.Items(i).Text + "<br>"
end if
next
End Sub
</script>
<!DOCTYPE html>
<html>
<body>
<form runat="server">
<asp:CheckBoxList id="check1" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="Check"
runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:CheckBoxList>
<br>
<asp:label id="mess" runat="server"/>
</form>
</body>
</html>
结果:
相关文章
- ASP.NET Web Pages – 发布
- ASP.NET 导航
- ASP.NET LinkButton 控件
- ASP.NET BulletedList 控件
- WebSecurity IsConfirmed 方法
- HTML Image 2
- ASP.NET HTML 控件 Hyperlink
- ASP.NET HTML 控件 Panel
- ASP.NET HTML 控件 Page.IsPostBack
- ASP.NET Enabled 属性
- ASP.NET Panel DefaultButton 属性
- ASP.NET Style BorderStyle 属性
- ASP.NET Style ForeColor 属性
- ASP.NET Table CaptionAlign 属性
- ASP.NET Table HorizontalAlign 属性
- ASP.NET Page 属性
- 检查用户是否仍然与服务器相连
- 略过文本文件的一部分
- validationsummary
- checkbox