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     }
  • 相关阅读:
    多属性量化决策模型
    对称加密与非对称加密
    子网掩码
    网络安全
    万维网WWW、电子邮件email与文件传输FTP
    DHCP协议
    DNS协议
    ARP协议与RARP协议
    springboot WebSocket的使用
    Java调用Python的两种方式
  • 原文地址:https://www.cnblogs.com/wanghafan/p/2487754.html
Copyright © 2011-2022 走看看