zoukankan      html  css  js  c++  java
  • 循环显示checkboxlist控件项的时候,count到底要不要 1

    我一直认为要减,但是今天我却发现不减才才对,代码如下

    ========html页================
      <asp:CheckBoxList id=chk style="Z-INDEX: 101; LEFT: 208px; POSITION: absolute; TOP: 96px" runat="server">
    <asp:ListItem Value="1111">1111</asp:ListItem>
    <asp:ListItem Value="222">222</asp:ListItem>
    <asp:ListItem Value="3333">3333</asp:ListItem>
    <asp:ListItem Value="444444">4444</asp:ListItem>
    <asp:ListItem Value="5555">5555</asp:ListItem>
    </asp:CheckBoxList>
    <asp:Button id=Button1 style="Z-INDEX: 102; LEFT: 208px; POSITION: absolute; TOP: 240px" runat="server" Text="Button"></asp:Button>

    ===========.cs页==============

       for(int i=0;i<this.chk.Items.Count-1;i++)
        if (this.chk.Items[i].Selected)
        {
        Response.Write(this.chk.Items[i].Text+"<br>");
        }

    ==============完===================

    如果减1的话,那么最后一项就显示不出来!
  • 相关阅读:
    Vue学习路线
    国庆游
    Axure RP 9 Beta 开放下载(更新激活密钥和汉化包)
    python虚拟环境
    异步任务神器 Celery-入门
    pymysql操作mysql
    安装 RabbitMQ
    GIT工作流
    flask入门与发送邮件与QQ邮箱
    Mysql第一周
  • 原文地址:https://www.cnblogs.com/thcjp/p/347986.html
Copyright © 2011-2022 走看看