zoukankan      html  css  js  c++  java
  • Repeater

    Repeater 强制保留两位小数 

    View Code
     1  <asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound">            
     2       <HeaderTemplate>
     3         <table class="tb_Content" border="0" cellpadding="0" cellspacing="1">
     4         <tr class="tr_Top"><td colspan="29" align="center"><b>项目跟踪管理表</b></td></tr>
     5         <tr class="tr_Top">
     6           <td align="center" style="100px;"><b>到款金额</b></td>
     7         </tr>
     8       </HeaderTemplate>
     9       <ItemTemplate>
    10         <tr class="tr_Content">            
    11           <td align="center"><%#Eval("BilingCount").ToString().Equals(string.Empty) ? "0.00" :Eval("BilingCount","{0:f}")%></td>
    12         </tr>
    13        </ItemTemplate>
    14       <FooterTemplate>
    15         <tr class="tr_Content"> 
    16           <td align="center"><%#BilingCount.Equals(0) ? "0.00" :String.Format("{0:f}",BilingCount)%></td>                      
    17         </tr>
    18       </table>
    19       </FooterTemplate>
    20     </asp:Repeater>
    View Code
    1 public decimal BilingCount = 0;
    2     protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    3     {
    4         if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    5         {
    6             BilingCount += Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "BilingCount").ToString().Trim());
    7         }
    8     }
  • 相关阅读:
    2021/9/20 开始排序算法
    快速排序(自己版本)
    2021/9/17(栈实现+中后缀表达式求值)
    2021/9/18+19(中缀转后缀 + 递归 迷宫 + 八皇后)
    20212021/9/13 稀疏数组
    2021/9/12 线性表之ArrayList
    开发环境重整
    Nginx入门
    《财富的帝国》读书笔记
    Linux入门
  • 原文地址:https://www.cnblogs.com/wanghafan/p/2487754.html
Copyright © 2011-2022 走看看