Asp.net(C#)-資料繫結格式化

來源:互聯網
上載者:User
DataFormatString="{0:格式字串}" 
1、時間格式化:{0:yyyy-MM-dd}
2、格式數字字串 輸入 結果 
"{0:C}" 12345.6789 $12,345.68 
"{0:C}" -12345.6789 ($12,345.68) 
"{0:D}" 12345 12345 
"{0:D8}" 12345 00012345 
"{0:E}" 12345.6789 1234568E+004 
"{0:E10}" 12345.6789 1.2345678900E+004 
"{0:F}" 12345.6789 12345.68 
"{0:F0}" 12345.6789 12346 
"{0:G}" 12345.6789 12345.6789 
"{0:G7}" 123456789 1.234568E8 
"{0:N}" 12345.6789 12,345.68 
"{0:N4}" 123456789 123,456,789.0000 
"Total: {0:C}" 12345.6789 Total: $12345.68 
DataFormatString="{0:P}" //自動轉換為百分數

以貨幣格式顯示數值。 


以十進位格式顯示數值。 


以科學記號標記法(指數)格式顯示數值。 


以固定格式顯示數值。 


以常規格式顯示數值。 


以數字格式顯示數值。 


以十六進位格式顯示數值。 

數字格式字串 
http://msdn2.microsoft.com/zh-cn/library/427bttx3(VS.80).aspx 
日期與時間格式字串 
http://msdn2.microsoft.com/zh-cn/library/97x6twsz(VS.80).aspx 
枚舉格式字串 
http://msdn2.microsoft.com/zh-cn/library/c3s1ez6e(VS.80).aspx 
自訂格式字串 
http://msdn2.microsoft.com/zh-cn/library/0asazeez(VS.80).aspx 
複合格式化 
http://msdn2.microsoft.com/zh-cn/library/txafckwd(VS.80).aspx
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.