CheckBoxList

<html>
<head>
 

    <script language="VB" runat="server">

      Sub Button1_Click(sender As Object, e As EventArgs)
           
          Dim s As String = "选定项:<br>"
          Dim i As Int32

          For i = 0 to Check1.Items.Count-1
              If Check1.Items(i).Selected Then
                  ' 列出选定的项
                  s = s & Check1.Items(i).Text
                  s = s & "<br>"
              End If
          Next

          Label1.Text = s
       End Sub

       Sub chkLayout_CheckedChanged(sender As Object, e As EventArgs)
      
          If chkLayout.Checked = true Then
             Check1.RepeatLayout = RepeatLayout.Table
          Else
             Check1.RepeatLayout = RepeatLayout.Flow
          End If
       End Sub
      
       Sub chkDirection_CheckedChanged(sender As Object, e As EventArgs)
      
          If chkDirection.Checked = true Then
             Check1.RepeatDirection = RepeatDirection.Horizontal
          Else
             Check1.RepeatDirection = RepeatDirection.Vertical
          End If
       End Sub

    </script>

</head>
<body>

    <h3><font face="宋体">CheckBoxList 示例</font></h3>

    <form runat=server>

        <asp:CheckBoxList id=Check1 runat="server">
            <asp:ListItem>项 1</asp:ListItem>
            <asp:ListItem>项 2</asp:ListItem>
            <asp:ListItem>项 3</asp:ListItem>
            <asp:ListItem>项 4</asp:ListItem>
            <asp:ListItem>项 5</asp:ListItem>
            <asp:ListItem>项 6</asp:ListItem>
        </asp:CheckBoxList>

        <p>
       
        <asp:CheckBox id=chkLayout OnCheckedChanged="chkLayout_CheckedChanged" Text="显示表布局" Checked=true AutoPostBack="true" runat="server" />

        <br>
       
        <asp:CheckBox id=chkDirection OnCheckedChanged="chkDirection_CheckedChanged" Text="水平显示" AutoPostBack="true" runat="server" />

        <p>
       
        <asp:Button id=Button1 Text="提交" οnclick="Button1_Click" runat="server"/>

        <p>
       
        <asp:Label id=Label1 font-name="宋体" font-size="9pt" runat="server"/>

    </form>

</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值