• DataList多行数据后添加分隔线


    类似
    *******
    *******
    *******
    *******
    ----------
    *******
    *******
    *******
    *******
    ----------

    *******
    *******
    *******
    *******
    ----------
     

    方法一:
    在后台定义一个公共计数变量
    public int i = 0;
    <asp:dataList id="">
    <asp:itemteplate>
    <%
    if(i++%4==0 && i>0)
    {
    %>
    <hr>
    <%
    }
    %>
    </asp:itemtemplate>
    </asp:dataList>


    方法二:
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
           
    if ((e.Item.ItemIndex + 1) % 4 == 0)
            {
                Literal lit
    = new Literal();
                lit.Text
    = "<hr />";
                e.Item.Controls.Add(lit);
            }

        }

  • 相关阅读:
    PKU1008
    PKU 1007
    PKU 3983
    PKU 1005
    PKU1004
    PKU 1003解题
    new.target
    debugger 关键字
    React 高阶组件
    CSS|规范
  • 原文地址:https://www.cnblogs.com/Magicam/p/1339705.html
Copyright © 2020-2023  润新知