zoukankan      html  css  js  c++  java
  • mvc2.0与3.0 便利一行三个元素 便利多行代码

    2.0
    <% List<GomeCps.Entity.EntityVO.EarnerInfosVO> list = ViewData["list"] as List<GomeCps.Entity.EntityVO.EarnerInfosVO>; %>

    <% if(list != null && list.Count > 0) {%>
    <% for (int i=0 ;i<list.Count ;i++)
    {%>
    <% if(i==0)
    {%>
    <tr>
    <%} %>

    <% if(i >0&&i% 2==0)
    {%>
    </tr>
    <tr>
    <%} %>
    <td width="5%" style=" 20px"><%: list[i].Ea%></td>
    <td width="10%"><input type="text" readonly="readonly" style="border: none; 43px" name="Ear" value="<%:list[i].Com %>"/></td>
    <td width="10%"><span><%:list[i].SumPrice %></span></td>
    <td ><input type="checkbox" id="items" name="items" value="<%: list[i].Ear %>"/></td>

    <% if( i==list.Count-1)
    {%>
    </tr>
    <%} %>

    <% } %>
    <% } %>

    3.0


    @{

    const int step = 4;
    for (int i = 0; i < Model.Count;)
    {
    int mid1 = i + step;
    int midLen = mid1 > Model.Count ? Model.Count : mid1;
    <ul class="shop_hot-list clearfix" style="float:left;">
    @for (int j = i; j < midLen; j++)
    {
    <li>
    <div class="hot-listcon">
    <a href="@(Model[j].WapUrl)?openid=@openId">
    <img src="@Model[j].ImageUrl" alt=""/>
    <p class="fc6 fs12 ellipsis_two" style="height:3.2rem;">@WebHelper.SubString(Model[j].Description, 20)</p>
    <div class="clearfix">

    <p style="color: #ef3030; margin-top:5px;">¥<span>@WebHelper.MoneyStr(@Model[j].Price)</span></p>

    @if(isShowCommission)
    {
    <p class="mt4 border_red" >红¥<span>@WebHelper.MoneyStr(@Model[j].Commission)</span></p>
    }


    </div>
    </a>
    </div>

    </li>
    }

    </ul>
    i += step;

    }
    }

    List<StoreProductCategorycount> Categorylist = ViewBag.CategoryList as List<StoreProductCategorycount>;

  • 相关阅读:
    十一.状态设计模式
    十. 享元设计模式
    Orcale(一)概念
    java类加载器
    spring中的事务管理机制
    spring中的annotation注解类配置
    countDownLatch和Semaphore用于多线程
    布隆过滤器
    mybatis-genator自动生成的mapper中模糊查询使用方法
    java中的异常
  • 原文地址:https://www.cnblogs.com/fu123/p/5139664.html
Copyright © 2011-2022 走看看